C Program to Check Armstrong Number
#include<stdio.h> #include<conio.h> void main() { int n, q, rem, s=0; clrscr(); printf("Enter the integer number:"); scanf("%d",&n); q=n; while(q>0) { rem=q%10; s=s+(rem*rem*rem); q=q/10; } if(n==s) printf("It is Armstrong number! %d",n); else printf("It is not Armstrong number! %d",n); getch(); }
Output :
Enter the integer number: 153
It is Armstrong number!