C++ Program To Check Number Is Armstrong Or Not

Problem :- Write A Program To Check Number Is Armstrong Or Not

Armstrong Number :- An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371 source Click Here

Logic :- Logic is very simple you have to you have to separate all digit and sum of the cube of digit find 
Example :- let's check 371  
then divide by 10 we got 371/10=1 .cube of 1 is 1 store this result and again divide by 10 we got 37/10=7 . cube of 7 is 343 store and add to previously got result 1 so now its become 344  ,again divide by 10 we got 3/10=3 cube of 3 is 27 ,Now again add 27+344=371
so the Number is Armstrong Number 

Note :- Divide the number by 10 until it become Zero

Solution :-

using namespace std;
int main()

  //By-Ghanendra Yadav
  int i,n1,num=0,n2,rem;

  cout<<"Enter The Number :\n";
  cout<<"Number is Armstrong\n";
  cout<<"Number is not Armstrong\n";
 return 0; 



C++ Program To Check Number Is Armstrong Or Not

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me