C programming examples with output:
Program
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d;
clrscr();
printf("Enter any number : ");
scanf("%d",&a);
b=a;
c=0;
while(a>0)
{
d=a%10;
c=c+(d*d*d);
a=a/10;
}
if(d==c)
printf("%d is an Armstrong Number",b);
else
printf("%d is not an Armstrong Number",b);
getch();
}
Output
Enter any number: 153
153 is an Armstrong Number
Enter any number 167
167 is not an Armstrong Number
0 komentar:
Post a Comment