Re: 11461 - Square Numbers
Posted: Tue Jul 15, 2014 11:48 pm
Third way is close to correct answer.
The problem description:
It is better to work only with integers. sqrt returns double value.
The problem description:
Change lineGiven two numbers a and b you will have to find out how many square numbers are there between a and b (inclusive).
Code: Select all
if(i==sqrt(i)*sqrt(i))
coun++;

Code: Select all
int j = sqrt(i);
if(i==j*j)
coun++;