Run Code
|
API
|
Code Wall
|
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
co_assign_1_ques_1
Test 5(2020)
Income calculator
RecursiveFact
shared_ptr deleter
mur1
CqueueArray
BubDoubArray
ttt
sdefrgthyjukiujyhtg