Program Source Code
//Write a program to check accepted number is armstrong number or not. #include"stdio.h" #include"conio.h" void main() { int i,no,r,sum=0; clrscr(); printf("*******Armstrong Number******"); printf("\n Enter a number"); scanf("%d",&no); i=no; while(no!=0) { r=no%10; sum=sum+(r*r*r); no=no/10; } if(sum==i) printf("Number is a Armstrong number\n"); else printf("Number is not a armstrong number\n"); getch(); }
Output