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
constructing object on first use as return value of (pointer to) object-returning function
C++
ForwardLiceSplice
TPSI Primo esercizio
Proga1
alternate list
strict aliasing
Ballin primality test
SEJM BLURWA
ExceptionHandling4