I have understood the question but I am not able to start the code. Can you please explain the answer with a full code.
Is Armstrong Number
@avijuneja2007 Say you are given a 4 digit number 1634
1634= 1^4 + 6^4 + 3^4 + 4^4 (So 1634 is an armstrong number)
Similarly:
153= 1^3 + 5^3 + 3^3 (So 153 is an armstrong number)
So by these examples you will get what an armstrong number is.
So to check if a number is armstrong number you just have to count the number of digits and extract each digit. Maintain a sum of (digit)^ noofdigits. If at the end of the loop, this sum==the given number then the number is armstrong else it is not armstrong.
To extract last digit of a number—> number%10
To remove last digit of the number–> number/10
Using this logic try to implement on your own. I will share the code with you if you are not able to code.
I am not able to write the code. Please share the code…
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.