Computer Science, asked by somasekharreddy1436, 1 day ago

int x = 0;
for (x=1; x<4; x++)
;
printf("x=%d\n", x);​

Answers

Answered by kapil765
2

Answer:

x=1

x=2

x=3

Explanation:

Understanding program from the beginning

line1: as we have declared x of int type and initialize it as 0

line2:for loop starts running

control go to initialization and i value changes from 0 to 1

then control move to conditional operator and check if condition is true for 1<4 it is true so, it will move to statement and print x=1

then i value incement by 1 and i becomes 2

i=2, 2<4==true, prints x=2,  i++

i=3, 3<4==true, prints x=3,  i++

i=4, 4<4≠true control come out of loop and program will end

Answered by smitkunpara
0

Answer:

0

Explanation:

ans is 0 because for loop is ended by ' ; '. So it will prints

Similar questions