0

Code is not working of printing Armstrong's numbers in a range. Can anyone help please?

https://code.sololearn.com/ck3HtyaxmmQc/?ref=app

25th Sep 2019, 5:48 AM
Yashwant Koshta
Yashwant Koshta - avatar
3 odpowiedzi
+ 1
Yashwant Koshta problem is digit[n] declaration... array should not be dynamic... on top of that , you have not initialised n also which might take 0 value by default... try with digit[50] and it should work. I inputed 153 153 as input and got output as 153 as expected... if you don't wanna go with fix size array , use vector.... additionally, you are doing power of digits as number of digit. as far as I know, it should be cube of digits ... still you can cross check definition of Armstrong number... for 153, it worked as digits are also 3 and hence you are doing power to 3 only.
25th Sep 2019, 6:13 AM
Ketan Lalcheta
Ketan Lalcheta - avatar