0
Check Armstrong number
Write a program which checks if a number is Armstrong or not. Armstrong number is a number which is equal to sum of digits raise to the power total number of digits in the number. Some Armstrong numbers are: 0, 1, 4, 5, 9, 153, 371, 407, 8208 etc. For example :153 1^3 +5^3 +3^3=153(Armstrong number) Any language is welcomed Thumbs up my question if you like it.. Happy coding :)
8 Réponses
+ 17
in java... 😃
https://code.sololearn.com/c6IGxx1AaiWr/?ref=app
+ 12
https://code.sololearn.com/cTUMw4i9B7KJ/?ref=app
+ 10
@Chinmoy it's fix now for any number
+ 5
https://code.sololearn.com/c70l69xJWNzK/?ref=app
A one-liner solution (actually 2)
+ 4
Please, this has been asked several rimes.
But I haven't tried once, so I shall go ahead
+ 3
GAWEN there's only one problem with your code it will only work if the length of entered number is 3..... Like if I enter 8208 or 9 it won't work... Read the question again :)
+ 1