#include<iostream.h>
#include<conio.h>
void main()
{
int n,n1,s=0,d;
clrscr();
cout<<"Enter the Value:";
cin>>n;
n1=n;
while(n!=0)
{
d=n%10;
s=s+(d*d*d);
n=n/10;
}
if(s==n1)
{
cout<<"The given Number "<<n1<<" is an Armstrong Number";
}
else
{
cout<<"The given Number "<<n1<<" is not an Armstrong Number";
}
getch();
}
No comments:
Post a Comment