#include <stdio.h>
int fun(int n)
{
int i,ret = 0,flag_sqrt = 0;
for(i = 0;i < n/2;i++)
{
if((i*i) == n)
{
flag_sqrt++;
break;
}
}
short high_two_bit = n >> 16,low_two_bit = n;
for(i = 0;i < high_two_bit/2;i++)
{
if((i*i) == high_two_bit)
{
flag_sqrt++;
break;
}
}
for(i = 0;i < low_two_bit/2;i++)
{
if((i*i) == low_two_bit)
{
flag_sqrt++;
break;
}
}
if(flag_sqrt == 3)
{
return 1;
}else{
return
0;
}
}
int main()
{
printf("%d\n",fun(9999));
return 0;
}
还没验证,不是键盘输入,思路大概是这样