#include<stdio.h>
#include<conio.h>
void main()
{
int n,n1,r,s=0;
clrscr();
printf("Enter the number:\n");
scanf("%d",&n);
n1=n;
while(n!=0)
{
r=n%10;
s=s+r*r*r;
n=n/10;
}
if(n1==s)
{
printf("Armstrong number\n");
}
else
{
printf("Not Armstrong number\n");
}
getch();
}
THE ABOVE IMAGE IS THE OUTPUT OF ARMSTRONG PROGRAM.
No comments:
Post a Comment