hi..
i was doing the exercise from ..a website..
I managed to write the code..to find the armstrong number...but the question is actually under the nested loop section
but my program does not have any nested loop..can someone show an alternative..or at least advice..on how I can convert my program to something that uses nested loop
This is the question, An Angstrom number is one whose digits, when cubed, add up to the number itself. For instance, 153 is an Angstrom number, since 13 +53 +33 =153 .
Write a program to input a number, and determine whether it is an Angstrom number or not.
Hint: The modulus operator (%) will be useful here.
And..I needed to input the digits.I used "total" to input the number of digits..and then the digits as the "number".
So. if I know the number of digits..I can tell the program to divide as many times..as the number of digits..
Anyway, one way you could figure out the number of digits would be dividing it by its base (10, in this case) until the integer part is 0. It'll have as many digits as the number of divisions performed.