Write a program to display whether the entered number is a Armstrong number or not

//This is a program to display whether the entered number is a Armstrong number or not
#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem,ori,sum=0;

printf("\n\nEnter any number: ");
scanf("%d",&num);

ori=num;

while(num>0)
{
rem=num%10;
sum=sum+(rem*rem*rem);
num=num/10;
}

if(sum==ori)
{
printf("\n\nThe Entered Number %d is a Armstrong Number.",ori);
}
else
{
printf("\n\nThe Entered Number %d is not an Armstrong Number.",ori);
}
getch();
}

Previous
Next Post »