int i int j fori 1 i SolutionHere in this code initially in

int i; int j; for(i = 1; i

Solution

Here in this code initially in the first loop i is declared as 1,the condition is i<5 and then the increment is i=i + 1 which means i= i++ so that for every succesful repetetion of for loop it will increment the value of i by 1 so the first loop will runs for 4 times that is for the values of i=1,i=2,i=3,i=4 but for the value of i=5 the for loop condition will not satisfy because 5 is not less than 5 , then the loop will terminated for the value of i=5;

then coming to second for loop which is in the first for loop the j value is declared as 1 and the condition is j<=2 with increment of j=j+1 which means j=j++; so the second loop will runs for 2 times for the values of j=1 and j=2; and for j=3 the loop will be terminated because the condition j<=2 doesn\'t get satisfy because 3 is not lesser than 2;

and in the printf statement the value to be printed is i*j (multiplication of i and j);

output explaination:

---------------------------

for the first time running of first loop the value of i is \"1\" it will go to the second loop and the value of j is \"1\" then the output is i*j=1*1=\"1\" then the value of j is incremented by 1 then the second loop repeats for j=2,then the output is 1*2=\"2\"

so for i =1 value the output is 1 2

similarly for the second time running of first loop the value of i is \"2\" (becuse i is incremented by 1) it will go to the second loop and the value of j is \"1\" then the output is i*j=2*1=\"2\" then the value of j is incremented by 1 then the second loop repeats for j=2,then the output is 2*2=\"4\";

so for i =1 value the output is 2 4

similarly for the third time running of first loop the value of i is \"3\" (becuse i is incremented by 1) it will go to the second loop and the value of j is \"1\" then the output is i*j=3*1=\"3\" then the value of j is incremented by 1 then the second loop repeats for j=2,then the output is 3*2=\"6\";

so for i =1 value the output is 3 6

similarly for the fourth time running of first loop the value of i is \"4\" (becuse i is incremented by 1) it will go to the second loop and the value of j is \"1\" then the output is i*j=4*1=\"4\" then the value of j is incremented by 1 then the second loop repeats for j=2,then the output is 4*2=\"8\";

so for i =1 value the output is 4 8

and then the value of i is 5 then the condition will not satisfy in the first loop(5 is not less than 5) so the looop will be terminated.

so the output is :

1 2

2 4

3 6

4 8

 int i; int j; for(i = 1; i SolutionHere in this code initially in the first loop i is declared as 1,the condition is i<5 and then the increment is i=i + 1 w

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site