#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c,d,m,x,arm;
printf("Enter four 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;
d=x%10;
x=x/10;
arm=pow(a,4)+pow(b,4)+pow(c,4)+pow(d,4);
if(arm==m)
{
printf("Enter number is Armstrong");
}
else
{
printf("Enter number is not Armstrong");
}
}
OUTPUT
Enter four digit number
1634
Enter number is Armstrong
Comments
Post a Comment