I need to find all the numbers that are perfect square between 1000 and 9999 and the first 2 digits are the same and the last 2 digits are the same>
to find all numbers between 1000 and 9999 which are perfect squares,
a. determine the integer a which is just larger than square root of 1000
b. determine the integer b which is just larger than square root of 9999
write a loop to get the square of each integer in the interval [a,b).
note: use the function std::sqrt() in header <cmath> to determine the square root of a floating point number.
int from = int( std::sqrt( 1000.0 ) ) + 1 ;
int to = int( std::sqrt( 9999.0 ) ) + 1 ;
for( int n = from ; n < to ; ++n )
int square = n * n ;
the first two digits of a positive four digit number x is the quotient you get when you divide x by 100.
the last two digits of a positive number x is the remainder you get when you divide x by 100.
if( ( x / 100 ) == ( x % 100 ) )
the first two digits of x are the same as the last two digits.
combine these and you will have your program.