#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,m,x,arm;
printf("Enter three digit number\n");
scanf("%d",&x);
m=x;
a=x%10;
x=x/10;
b=x%10;
x=x/10;
c=x%10;
x=x/10;
arm=pow(a,3)+pow(b,3)+pow(c,3);
if(arm==m)
{
printf("Enter number is Armstrong");
}
else
{
printf("Enter number is not Armstrong");
}
OUTPUT
Enter three digit number
153
Enter number is Armstrong
Comments
Post a Comment