Important MCQ

Output? (sum of digits) int n = 1234, s = 0; while (n > 0) { s += n % 10; n /= 10; } cout << s;

Q.Output? (sum of digits) int n = 1234, s = 0; while (n > 0) { s += n % 10; n /= 10; } cout << s;

A) 4
B) 10
C) 24
D) 1234
Correct Answer:
Option B