ProgrammingModerate
What is the first printed value of this loop? for (int i = 3; i > 0; i--) printf("%d", i);
- A. 321
- B. 123
- C. 3
- D. 32
Correct answer: A. 321
The loop runs with i = 3, 2, 1, so the digits print in decreasing order.
More C Programming questions
- int x = 0; while (x < 3) x = x + 1; printf("%d", x); What is printed?
- int count = 0; for (char c = 'a'; c <= 'z'; c++) if (c != 'e' && c != 'i' && c != 'o' && c != 'u') count++; printf("%d", count); What is…
- printf("%d", 3 > 2 ? 'Y' : 'N'); What is printed?
- char names[] = {"x", "yy", "zzz"}; printf("%zu", strlen(names[2])); What is printed?
- int a[4] = {4, 3, 2, 1}; int s = 0; for (int i = 0; i < 4; i++) s = s 10 + a[i]; printf("%d", s); What is printed?
- int i = 1; int s = 0; while (i <= 4) s += i++; printf("%d", s); What is printed?