Search

# Armstrong Number in C++

Armstrong Number is a number that is equal to the sum of cube of its digits.

Example 153

1*1*1+5*5*5+3*3*3=153 which is a Armstrong number.

Other Examples are 0,1,370,371

Program to check whether a given number is palindrome or not

• #include <iostream>

• using namespace std;

• int main()

• {

• int n,r,sum=0,temp;

• cout<<"Enter the Number= ";

• cin>>n;

• temp=n;

• while(n>0)

• {

• r=n%10;

• sum=sum+(r*r*r);

• n=n/10;

• }

• if(temp==sum)

• cout<<"Armstrong Number."<<endl;

• else

• cout<<"Not Armstrong Number."<<endl;

• return 0;

• }

Output â€“

Enter the Number= 371

Armstrong Number.

For Video Tutorials Subscribe our Youtube Channel

---------------------------------------------------------------------------------------------------------------------------

Previous Page Next Page

Any Doubt ? Feel free to write a comment

Mandatory to join Telegram group for regular job updates

Mandatory to join whatsapp group for regular job updates

Other C++ Programs

Tags:

### Related Posts

See All

#### Number to Character Conversion in C++

Program to implement Number to Character Conversion in C++ Firstly see what we are going to do ? Like this 0 - zero 1 â€“ one 2 â€“ two 3 â€“ three 4 â€“ four 5 â€“ five 6 â€“ six 7 â€“ seven 8 â€“ eight 9 â€“ nine How

#### Factorial of a number in C++

In this tutorial we are going to see how to find a factorial of number using C++ program Firstly letâ€™s see a example to understand it better n! = n + (n-1) + (n-2) ! n>=1 3! = 3 *2*1 = 6 Program to fi

#### Fibonacci Triangle in C++

Program to implement Fibonacci Triangle in C++ #include <iostream> using namespace std; int main() { int a=0,b=1,i,c,n,j; cout<<"Enter the limit: "; cin>>n; for(i=1; i<=n; i++) { a=0; b=1; cout<<b<<"\