初学者求别的写法
这个有没有别的写法#include<stdio.h>
#include <math.h>
void main()
{
int x;
x=0;
loop:if(sqrt(x+100)==(int)sqrt(x+100)&&sqrt(x+168)==(int)sqrt(x+168))
{
printf("%d\n",x);
}
else
{
x++;
goto loop;
}
}
#include <stdio.h>
#include <math.h>
void main(){
int x = 0;
while(sqrt(x + 100) != (int)sqrt(x + 100) || sqrt(x + 168) != (int)sqrt(x + 168)){
x++;
}
printf("%d\n",x);
} 为什么要用goto啊,用while不就好了吗?
页:
[1]