THis is supposed to work. What is wrong?
#include <stdio.h>
#include <math.h>
main()
{
int a=0;
float b=0;
while (!feof(stdin))
{
scanf("%d", &a);
b=sqrt(a);
if (feof(stdin))
printf("%.4f\n",b);
}
}
It works fine at my PC. But it keeps saying wrong answer?
Re: THis is supposed to work. What is wrong?
#include <stdio.h>
#include <math.h>
main()
{
int a=0;
float b=0;
while (!feof(stdin))
{
scanf("%d", &a);
b=sqrt(a);
printf("%.4f\n",b);
}
}
Re: THis is supposed to work. What is wrong?
You should use a long long data type, because the int type supports only 2^32 as max. Please, read the contraints of the problem. There says that the number could be as big as 10^18 (a lot bigger than 2^32). Try with long long. Hope it be useful for you.