#include<stdio.h>
#include<conio.h>
main()
{
int num,d,sum=0,a;
clrscr();
printf("\n enter the number=");
scanf("\n %d",&num);
a=num;
while(a)
{
d=a%10;
sum=sum+d*d*d;
a=a/10;
}
if(num==sum)
printf("\n this is armistrong number");
else
printf("\n this is not armistrong number");
getch();
}
output:-enter the number=153
this is armistrong number
No comments:
Post a Comment