Program to determine whether a given number is a Disarium numberExplanationIn this program, we need to check whether the given number is Disarium or not. Disarium number A number is said to be the Disarium number when the sum of its digit raised to the power of their respective positions is equal to the number itself. For example, 175 is a Disarium number as follows 11 + 72 + 53 = 1 + 49 + 125 = 175 Some of the other examples of Disarium number are 89, 135, 518 etc. To find whether given number is Disarium or not, calculate the sum of digits powered with their respective positions. If the sum is equal to the original number then, the given number is Disarium number. Algorithm
SolutionPythonOutput: 175 is a disarium number COutput: 175 is a disarium number JAVAOutput: 175 is a disarium number C#Output: 175 is a disarium number PHPOutput: 175 is a disarium number Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India