Merge pull request #28 from alkino/patch-1

Fix happy number algorithm.
This commit is contained in:
Sachin Arora 2017-09-29 20:31:47 +05:30 committed by GitHub
commit d43d62adc2

View File

@ -7,14 +7,14 @@ int main()
int n,k,s=0,d;
cout << "Enter a number:";
cin >> n;
s=n;k=n;
s=0;k=n;
while(k>9)
{
while(k!=0)
{
d=n%10;
d=k%10;
s+=d;
n/=10;
k/=10;
}
k=s;
s=0;