Question: Given the following program in figure below. = 1 #include 2 int main() 3 { int x = 20; 4 while(x > 10) 5 {

 Given the following program in figure below. = 1 #include 2

Given the following program in figure below. = 1 #include 2 int main() 3 { int x = 20; 4 while(x > 10) 5 { if (x85==0) 6 { printf ("x = %d ",x); 7 } 8 x++; 9 } 10 return 0; 11 } 000 a) In the above program, the while loop will be executed for an infinite number of times. Explain why this condition happens b) Rewrite the while loop so that the infinite loop could be avoided. c) Based on your answer in 3(a)(ii), determine the output of the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!