Question: 1. Trace the following program and show the output when the input n=10. scanf(%d, &n); ev = 0; while(ev < n) { printf(%3d, ev); ev

1. Trace the following program and show the output when the input n=10. scanf(%d, &n); ev = 0; while(ev < n) { printf(%3d, ev); ev = ev + 2; }

2. Show the output of the following nested loops. for(i = 0; i < 2; i++) { printf(Outer %4d , i); for(j = 0; j < 3; j++) printf(Inner %3d%3d , i, j); for(k = 2; k>0; --k) printf(Inner %3d%3d , i, k)

}

3. Rewrite the following program using a for loop. count = 0; i = 0; while (i < n) { scanf(%d, &x); if(x == 1) ++count; ++i; }

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!