Table of Contents

Armstrong Number

#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,num=0,arm;
printf("enter the number=");
scanf("%d",&n);
arm=n;
while(n>0)
{
r=n%10;
num=num+(r*r*r);
n=n/10;
}
if(arm==num)
{
printf("armstrong number ");
}
else
{
printf("not armstrong number");
}
getch();
}

Output

enter the number =153

armstrong number