//Armstrong Number
#include<stdio.h>
#include<conio.h>
void main()
{
int num,temp,rem,sum=0;
clrscr();
printf("\nEnter a Number:\t");
scanf("%d",&num);
temp=num;
while(num>0)
{
rem=num%10;
sum=sum+(rem*rem*rem);
num=num/10;
}
if(sum==temp)
printf("\nThe Number is Armstrong.");
else
printf("\nThe number is not Armstrong.");
getch();
}
0 comments:
Post a Comment