Unable to find error in this armstrong code
Question link pls…
Hey Mayur, your approach is not correct as first you should first count the no. of digits in the given number then get the summation of power(digit, no. of digit) for all the digits of the given number.
For eg.:
1634 = 1^4 + 6^4 + 3^4 + 4^4
In which library pow function exist
Tip: pow function might fail (as N is large ) so better use Fast Exponentiation.
and Pow is defined in #include<math.h>
Hit like if you get it!
Cheers.
1 Like