Write a c program to find whether a given number is armstrong or not

#include <stdio.h>
#include<conio.h>
main()
{
int n,e=0,c,b;
printf("enter no:");
scanf("%d",&n);
b=n;
while (n!=0)
{
c=n%10;
e=e+(c*c*c);
n=n/10;
}
if (e==b)
printf("the no is armstrong no\n");
else
printf("the no is not armstrong no\n");
}

Post a Comment

0 Comments