As it is time to study for finals, I have to cover some detailed information regarding loops.I am currently stuck on this question
int main(void) {
int x = 0;
int y = 0;
while (y < 10) {
x = 0;
while (x != y) {//
x = x + 3; // how many times will we do this statement?
}
printf(“x is %d\n”, x);
y = y + 1;
}
}
Basically, I am looking to see what the output is and how many times that statement we mentioned is run. In other words what does printf output look like.
I hope you can help me with this.
Thank you so much.
This line causes a problem
when
y=1sincexwill continue to increase until it reaches the maximum integer value (it cant equal y unless some overflow wrapping occurs – this will result in an infinite loop).