Hi all,
I did my solution to this code and it gave me runtime error NZEC. I don't know what the error means. So I started looking in the forum and I saw noix's solution. The thing is that while looking at that solution I realized that it doesn't the read content, this meaning that using stdin and stdout when I insert a number it prints the number back instead of printing it in the end. Of course that, if I redirect the stdin and stdout to files it will give the outputs and inputs correctly.
So my question is (besides that try to solve that error) what is in fact the expected behaviour of this program.
Thank you un advance for your help.
Henrique Vaz
Your code will be tested by redirecting standard input and standard output to/from a file then comparing the correct answer with your answer, so it makes no difference at what point in your program you print out the results, as long as they are printed out. NZEC means different things in different languages, but in C it normally means your main function isn't returning 0 like it always has to.
hello, guys! First of im complete newbie in programming in general and i'm very glad that i found this wonderful site, which really helps me to polish my programming skills!
so i came to this first problem and i tried to submit this code
include
int main(void) {
int n;
while (1) {
scanf ("%d",&n);
if (n != 42)
printf("%d",n); else break;
}
return (0);
}
it gives me same output as in noix'es solution (i use NetBeans 6.91 IDE), but for some reason SPOJ says wrong answer - im mad confused, any help?
Hi
Am new to programming world and this is my first attempt.
Could some one tell me what mistake am making in this pgm?
include
int i, num[5];
int main()
{
for (i=0;i<5;i++)
{
scanf("%d",&num[i]);
}
for (i=0;i<5 && num[i]!=42;i++)
{
printf("%d\n",num[i]);
}
return 0;
}
This works fine in terminal but not a right ans in SPOJ.