mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
commit
d43d62adc2
@ -7,14 +7,14 @@ int main()
|
|||||||
int n,k,s=0,d;
|
int n,k,s=0,d;
|
||||||
cout << "Enter a number:";
|
cout << "Enter a number:";
|
||||||
cin >> n;
|
cin >> n;
|
||||||
s=n;k=n;
|
s=0;k=n;
|
||||||
while(k>9)
|
while(k>9)
|
||||||
{
|
{
|
||||||
while(k!=0)
|
while(k!=0)
|
||||||
{
|
{
|
||||||
d=n%10;
|
d=k%10;
|
||||||
s+=d;
|
s+=d;
|
||||||
n/=10;
|
k/=10;
|
||||||
}
|
}
|
||||||
k=s;
|
k=s;
|
||||||
s=0;
|
s=0;
|
||||||
|
Loading…
Reference in New Issue
Block a user