Solution to Midterm Exam
1. What is the output?
#include <stdio.h>
main()
{
int i, j, k;
i = 2; j = 5; k = 0;
if(i == j)
printf("i equals j\n");
else {
while(j>k) {
printf("%d\n", j);
--j;
++k;
}
}
}
5
4
3
Next slide
Back to first slide
View graphic version