This program gives 2 2 2 as output but i don't get how? According to my understanding,
Initialization Cond Increment
0 true 1 so 1+2=3 should be printed then j=2-1=1 used
insertCode:#include<stdio.h> voidmain(){ inti,j=2; for(i=0;i<=5,j>=0;i++){ printf("%d ",i+j); j--; } }
And this program gives 2 2 2 2 2 . How does order in condition part affect output?
insertCode:#include<stdio.h> int main(){ inti,j=2; for(i=0;j>=0,i<=5;i++){ printf("%d ",i+j); j--; } return0; }