//Program to check the Armstrong Number
#include<stdio.h>
#include<conio.h>
int main()
{
int num,sum=0,rem,onum;
clrscr();
printf("Enter the number\n");
scanf("%d",&num);
onum=num;
while(num>0)
{
rem=num%10;
num=num/10;
sum=sum+rem*rem*rem;
}
if(sum==onum)
printf("\nThe number is Armstrong number ");
else printf("The number is not Armstrong number");
getch();
return 0;
}
To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.
#include<stdio.h>
#include<conio.h>
int main()
{
int num,sum=0,rem,onum;
clrscr();
printf("Enter the number\n");
scanf("%d",&num);
onum=num;
while(num>0)
{
rem=num%10;
num=num/10;
sum=sum+rem*rem*rem;
}
if(sum==onum)
printf("\nThe number is Armstrong number ");
else printf("The number is not Armstrong number");
getch();
return 0;
}
To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.