#include <stdio.h>
void main()
{
int n,x,temp,sum=0;;
printf("enter the number:");
scanf("%d",&n);
x=n;
while(n!=0)
{
temp=n%10;
sum=sum + temp * temp * temp;
n=n/10;
}
if(x==sum)
printf("number is armstrong");
else
printf("number is not armstrong");
}
void main()
{
int n,x,temp,sum=0;;
printf("enter the number:");
scanf("%d",&n);
x=n;
while(n!=0)
{
temp=n%10;
sum=sum + temp * temp * temp;
n=n/10;
}
if(x==sum)
printf("number is armstrong");
else
printf("number is not armstrong");
}
No comments :
Post a Comment