21 lines
401 B
C
21 lines
401 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
int main(void)
|
|
{
|
|
double n;
|
|
printf("Please input a number within 1000:\n");
|
|
while (1)
|
|
{
|
|
scanf("%lf",&n);
|
|
if (n>0 && n<1000)
|
|
{
|
|
printf("The sqrt of n is %d.",(int)sqrt(n));
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
printf("Syntax error, please re-enter it.\n");
|
|
}
|
|
}
|
|
return 0;
|
|
} |