filmov
tv
C Numbers 15: Check whether a number is Disarium or not [C Programming]

Показать описание
Write a program in C to check whether a number is Disarium or not.
Expected Output :
Input a number : 135
The given number is a Disarium Number.
=================================================
Disarium number
A number is said to be a Disarium number when the sum of its digit raised to the power of their respective positions is equal to the number itself.
Example:
Input : 135
Output : Yes
1^1 + 3^2 + 5^3 = 135
Input : 89
Output : Yes
8^1 + 9^2 = 89
Input : 80
Output : No
8^1 + 0^2 = 8
=================================================
Expected Output :
Input a number : 135
The given number is a Disarium Number.
=================================================
Disarium number
A number is said to be a Disarium number when the sum of its digit raised to the power of their respective positions is equal to the number itself.
Example:
Input : 135
Output : Yes
1^1 + 3^2 + 5^3 = 135
Input : 89
Output : Yes
8^1 + 9^2 = 89
Input : 80
Output : No
8^1 + 0^2 = 8
=================================================