Display the armstrong number

#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,d;
clrscr();
printf("Enter the number:\n");
scanf("%d",&n);
copy=n;
while(n!=0)
{
d=n%10;
sum=sum+d*d*d;
n=n/10;
}
if(copy==sum)
{
printf("It is armstrong number");
}
else
{
printf("It is not a armstrong number");
}
getch();
}
OUTPUT:
Enter the number:
153
It is armstrong number
Translate »