235k views
0 votes
How many times does the following code execute?

int x=0;
int y=3;
While x<=y
x=x+1;
endWhile



A. 0 B. 3C. infiniteD. 4 Program design and development

2 Answers

6 votes
Infinite because it is a infinite loop that is true and the first two lines were just declaring variables
User Eddy Pronk
by
9.6k points
3 votes
The first time the while statement is evaluated, x = 0 so the answer is D. 4
User Grokster
by
7.7k points