#include<iostream>
using namespace std;
int main()
{
int armstrong=0,num=0,result=0,check;
cout<<"Enter Number to find it is an Armstrong number?";
cin>>num;
check=num;
for(int i=1;num!=0;i++){
armstrong=num%10;
num=num/10;
armstrong=armstrong*armstrong*armstrong;
result=result+armstrong;
}
if(result==check){
cout<<check<<" is an Armstrong Number";
}
else{
cout<<check<<" is NOT an Armstrong Number";
}
return 0;
}
How to Learn a Programming Language. If you have an interest in creating computer programs, mobile apps, websites, games or any other piece of software. Learn the fundamentals of programming, explore programs made by others. Write your own programs and share them.
Saturday, 20 December 2014
Find Armstrong number in C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment