ProgrammingHard
printf("%d", (-17 % 5 + 5) % 5); What is printed in C99?
- A. -4
- B. 8
- C. 5
- D. 3
Correct answer: D. 3
-17 % 5 is -2 in C99, and adding 5 gives 3, which % 5 leaves as 3.
More C Programming questions
- What is printed? c #include <stdio.h> int main(void) { int a[] = {1, 2, 3, 4, 5, 6}; int l = a, r = a + 5; while (l < r) { int t = l; l++…
- What is printed? c #include <stdio.h> int main(void) { int a[] = {4, 1, 7, 3, 9}, p[6] = {0}; for (int i = 0; i < 5; i++) p[i + 1] = p[i]…
- A qsort comparator must order the uint16t values by high byte descending and, for equal high bytes, by low byte ascending. What is…
- What is printed? c #include <stdio.h> unsigned sumd(unsigned n) { return n == 0 ? 0 : n % 10 + sumd(n / 10); } int main(void) {…
- How many subsets of {1, 2, 3, 4, 5, 6} (the empty set included) have a sum divisible by 3? Compute with this program. c #include <stdio.h>…
- What is printed by the first two calls? c #include <stdio.h> unsigned next(void) { static unsigned s = 1; s = s 1103515245u + 12345u…