Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started