For loop in different format

void main()
{
int I,j;
for(i=1,j=10;i<6;++I,--j)
printf(“%d ,%d”,I,j);
}
Tutorial answer:
1,10,2,9,3,8,4,7,5,6
Debugging solution:
Normally for loop contain three important things,
for(initialization ;condition ;incre/decr)in these program initialization: contain two things
I=1,j=10,
Condition :it contain only one condition,
Incr/decr:++I,--j
So it will there I value is increase and j value is decrease in there every loop up to i<6,

Post a Comment

0 Comments