What's wrong with the following code in ERROR

After doing the problem error I found almost same solution which i wrote different times were evaluated differently …One was evaluated as Wrong answer and other excepted …Please help me debug the program
CodeChef: Practical coding for everyone ----------- the wrong one
CodeChef: Practical coding for everyone ----------the correct one

Can you please post the problem statement. i see only one difference here

Correct: scanf("%d\n",&test);
Your’s: scanf("%d",&t);

difference of \n :stuck_out_tongue:

1 Like

Good catch, but with gets that follows sncaf without '\n' is reads empty string…

I got you betlisa …But how come this program gets a right answer in my machine when it reads an empty string

Are you typing in the answer or using input file?

I am typing in .exe file while checking the output on my pc … not using any input file

Try using f input file as described in FAQ - http://discuss.codechef.com/questions/1375/how-should-i-test-my-program?page=1#1376

Thanks a lot betlista

@s1h33p was the one who found the problem :wink: Please upvote and/or accept his answer. I just helped with testing :wink: