TEST: Getting wa

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??

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

1288

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\n",i))

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

//