# Check Armstrong Number

“** Check Armstrong Number**” is again basic programming exercise problem for beginners. Here, we are given a number entered by user and our task is to write a program to check whether entered number is an Armstrong number or not.

A number is said to be **Armstrong number** when sum of cubes of each digit of the number equals to number itself.

For example, 153 = 1*1*1 + 5*5*5 + 3*3*3 = 1 + 125 + 27 = 153

**C++ Program to check Armstrong number is as follows:**

/* C++ Program to Check Armstrong Number */ #include<bits/stdc++.h> using namespace std; int main() { //Scan the number int num; cout<<"Enter the number:"; cin>>num; //Check Armstrong number int temp_num = num; int check = 0; while(temp_num > 0) { int digit = temp_num % 10; check = check + (digit * digit * digit); temp_num = temp_num / 10; } if(check == num) cout<<num<<" is an Armstrong Number"; else cout<<num<<" is not an Armstrong Number"; }

OUTPUT:Enter the number:153 153 is an Armstrong Number

**Related Posts:**

- Program to find GCD of two numbers.
- Program to find LCM of two numbers.
- Program to check whether entered number is odd or even.
- Program to check whether entered number is prime number or not.
- Program to check whether entered number is palindrome or not.
- Program to convert binary number to octal number.
- Program to convert binary number to decimal number.
- Program to convert binary number to hexadecimal number.
- Program to convert octal number to binary number.
- Program to convert octal number to decimal number.
- Program to convert octal number to hexadecimal number.
- Program to convert decimal number to binary number.
- Program to convert decimal number to octal number.
- Program to convert decimal number to hexadecimal number.
- Program to convert hexadecimal number to binary number.
- Program to convert hexadecimal number to octal number.
- Program to convert hexadecimal number to decimal number.
- Program to check Leap Year.
- Program to find sum of first ‘n’ natural numbers.
- Program to Reverse a Number.