#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
// insert code here…
double testcase =0,i=0;
scanf("%d",&testcase);
for (i=0; i<testcase; i++)
{
double N=0;
scanf("%lf",&N);
printf("%d",(int)N/2+1);
}
return 0;
}
Why do i get wrong answer for the following code?
1 Like
srd091
August 25, 2016, 2:12am
2
you’re missing ‘\n’ after every print statement and you are also taking double testcase as %d in input, just change testcase to int and add new line after each print statement.
Thanks a lot,how did you know this? i mean i never thought it could be the reason,is there any way to see why i receive the wrong answer
srd091
August 25, 2016, 12:02pm
4
just look through your code carefully and remember those points where you would possibly make mistake.