Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
single_digit
#include<iostream> using namespace std; int main() { int val, num, sum = 0; cout << "Enter the number : "; cin >> val; num = val; while(num>0){ while (num > 0) { sum = sum + num % 10; num = num / 10; } if(sum>=10){ num=sum; } cout << "The sum of the digits of " << val << " is " << sum; } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Web Browser History - DLL
11340 v3.0
BFS Basic
tasks
Web Browser History
Dar
325324
Print Euler Path
2015(M2)Mod.
410
Please log in to post a comment.