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