TEST: Getting wa

wa

#1

my compiler is gc++ 4.3.2
source code is

#include<stdio.h>
int main()
{
for(int i;(scanf("%d",&i)>0 && i!=42);printf("%d",i))
;
return 0;}

I am nt gtn why is ds gvn a wrong output??


#2

Your program doesn’t return correct output for example input, it returns

1288

#3

in this line for(int i;(scanf("%d",&i)>0 && i!=42);printf("%d",i))
you’re missing an endline so, it should be for(int i;(scanf("%d",&i)>0 && i!=42);printf("%d
",i))


#4

You are not printing new line after each input integer. Replace printf("%d",i) with printf("%d
",i) and this should work fine.