style: format code

This commit is contained in:
yanglbme
2019-08-21 10:10:08 +08:00
parent abc0d365de
commit 69ddc9fc52
101 changed files with 3154 additions and 2984 deletions

View File

@@ -1,20 +1,20 @@
//program to check whether a number is an armstrong number or not
#include<iostream.h>
#include<Math.h>
#include <iostream.h>
#include <Math.h>
int main()
{
int n,k,d,s=0;
cout<<"Enter a number:";
cin>>n;
k=n;
while(k!=0)
int n, k, d, s = 0;
cout << "Enter a number:";
cin >> n;
k = n;
while (k != 0)
{
d=k%10;
s+=(int)pow(d,3);
k/=10;
d = k % 10;
s += (int)pow(d, 3);
k /= 10;
}
if(s==n)
cout<<n<<"is an armstrong number";
if (s == n)
cout << n << "is an armstrong number";
else
cout<<n<<"is not an armstrong number";
cout << n << "is not an armstrong number";
}