ProgrammingModerateTCS NQT · Infosys
How many two-digit decimal numbers have digits summing to 9?
- A. 4
- B. 9
- C. 10
- D. 5
Correct answer: B. 9
Choosing the tens digit 1..9 fixes the units digit as 9 minus it, giving 18, 27, ..., 81, 90: 9 numbers. 10 wrongly adds 99 (a multiple of 9 whose digits sum to 18), while 5 and 4 count unordered digit pairs instead of numbers, with and without 90.
More C Programming questions
- The sorted array is {1, 3, 5, 7, 7, 9}. What is the index of the first element greater than 7?
- int n = 0; reading the expression as C does: What is the value of ~5 + 1?
- int n = 0; while (n++ < 3) ; What is n after the loop?
- unsigned char x = 100; x += 200; What is x?
- int x = 12; x &= x - 1; What is x?
- What does printf("%d", sizeof(int) > sizeof(char)) print?