# include <iostream.h>
# include<conio.h>
int isSquare (int);
int main( )
{
const int MAX = 20;
for ( int i =0; i < MAX; i++)
if (isSquare(i) )
cout<<i<<" is square. \n";
else
cout<<i<<"is not square. \n";
getch( );
return 0;
}
int isSquare( int n)
{
int i =0;
while ( i*i < n)
++i;
if ( i* i == n) return 1;
else return 0 ;
}
0 comments:
Post a Comment