#include<iostream.h>
#include<conio.h>
void main()
{
int sum=0,ch,i,j,num,no;
char ans='y';
clrscr();
cout<<"\nEnter a number : ";
cin>>no;
num=no;
do
{
sum=sum+(no%10)*(no%10)*(no%10);
no=no/10;
}
while(no!=0);
if(sum==num)
cout<<"\nThe number is an Armstrong number ";
else
cout<<"\nThe number is not an Armstrong number ";
getch();
}
#include<conio.h>
void main()
{
int sum=0,ch,i,j,num,no;
char ans='y';
clrscr();
cout<<"\nEnter a number : ";
cin>>no;
num=no;
do
{
sum=sum+(no%10)*(no%10)*(no%10);
no=no/10;
}
while(no!=0);
if(sum==num)
cout<<"\nThe number is an Armstrong number ";
else
cout<<"\nThe number is not an Armstrong number ";
getch();
}
0 comments:
Post a Comment