Back In the print window choose "Save as PDF" as the destination
NOTE.CS

Sum of Digits

1 topic ยท 28 Nov 2026
1

Sum of Digits

Problem Solving
C++
int n = 1234, sum = 0;
while(n > 0){
    sum += n % 10;
    n /= 10;
}
cout << sum; // 10