C Program to print Armstrong Numbers Between Two User Entered Integers

preview_player
Показать описание

An Armstrong number is an n-digit base b number such that the sum of its (base b) digits raised to the power n is the number itself.

Example 1:
If number = 153
It has 3 digits: 1, 5 and 3. So n = 3.
result = 33 + 73 + 13 = 27 + 343 + 1 = 371.
So the original number 153 is equal to the result. So it’s an Armstrong Number.

Example 2:
If number = 1634
It has 4 digits: 1, 6, 3 and 4. So n = 4.
result = 14 + 64 + 34 + 44 = 1 + 1296 + 81 + 256 = 1634.
So the original number 1634 is equal to the result. So it’s an Armstrong Number.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

Where is your 153? 153 also is a Armstrong number

张志雄-iz