Armstrong number n digit – CSKC
Sign In

Search

Code Learning #CPP#1573    siteicon   siteicon  

Armstrong number n digit

Checking for armstrong number which can be even more than 3 digit.

Source Code

TC++ #1573

 

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

while (n1 != 0){n1 /= 10;++digits;}
This portion of code helps to find number of digits in the given number.
num+=pow(rem,digits);
This line helps to provide exponentiation of individual digit to total number of digits.

most other portion of the code is same as given for finding a 3 digit armstrong number.

Notes

Please do not use an input number more than 11 digit, so that correctness of result can be ensured.


Suggested Filename(s): armstrong-n.cpp



Share

Created: 2-Dec-2017 14:56 | Updated: 15-Sep-2018 13:49|