Javatpoint Logo
Javatpoint Logo

Krishnamurthy Number Java

Krishnamurthy number is another special number in Java. A number is said to be Krishnamurthy if the factorial sum of all its digits is equal to that number. Krishnamurthy number is also referred to as a Strong number. Just like Prime and Armstrong numbers, Krishnamurthy number is also frequently asked by the interviewers but with it's another name, i.e., Strong number.

These are the following steps which we use to check Krishnamurthy number

  • We first take a number.
  • We then find the factorial of each digit of the number.
  • We add the factorial of each digit and store it into another variable.
  • If the sum of the factorial of each digit is the same as the original number, the number is a Krishnamurthy number.

Let's take an example of Krishnamurthy number.

Let's implement a program to check whether the user entered number is a Krishnamurthy number or not.

KrishnamurthyNumber.java

Output

Krishnamurthy Number Java

Let's implement one more program to get all the Krishnamurthy number in a given range

FindAllKrishnamurthyNumber.java

Output

Krishnamurthy Number Java
Next TopicVert.x Java





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA