C++ Programming Code Examples C++ > Mathematics Code Examples Any number of Digits Armstrong Program in C++ Any number of Digits Armstrong Program in C++ Armstrong number is a number that is the sum of its own digits each raised to the power of the number of digits is equal to the number itself. Some Armstrong numbers is 0, 1, 153, 370, 371, 407, 1634 etc. #include<iostream.h> #include<conio.h> void main() { int j; int f,rem,sum=0,temp,a=0; clrscr(); cout<<"Enter any number: "; cin>>j; temp=j; while(temp != 0) { temp=temp/10; a=a+1; } f=j; while(f!=0) { rem=f%10; sum = sum + power(rem,a); f=f/10; } if( sum == j ) cout<<"\n Armstrong number "; else cout<<"\n Not a Armstrong number"; getch(); } int power(int c, int d) { int pow=1; int i=1; while(i<=d) { pow=pow*c; i++; } return pow; }