Merge pull request #15 from shivhek25/master

Added armstrong number program.
This commit is contained in:
Chetan Kaushik
2017-04-08 23:35:14 +05:30
committed by GitHub
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
//program to check whether a number is an armstrong number or not
#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)
{
d=k%10;
s+=(int)pow(d,3);
k/=10;
}
if(s==n)
cout<<n<<"is an armstrong number";
else
cout<<n<<"is not an armstrong number";
}

BIN
Graph/.DS_Store vendored Normal file

Binary file not shown.

BIN
Greedy Algorithms/.DS_Store vendored Normal file

Binary file not shown.