+ 2

How to make a code in java so that it find a krishnamurthy number in an array.

25th Jul 2020, 4:57 PM
Swaraj Singh
Swaraj Singh - avatar
3 ответов
+ 5
1. Iterate over the array 2. Split each number into the digits it is build of 3. Calculate the factorial for each digit 4. Sum up and compare
25th Jul 2020, 5:28 PM
Sandra Meyer
Sandra Meyer - avatar
+ 5
Declare a sum variable within the for loop through the array, then join the inner loop over the numbers' digits and add the results of its factorials. Last step in outer loop, after the inner loop, is the comparison between number and sum...
26th Jul 2020, 12:56 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Yes Sandra Meyer you are right but i am finding it difficult to to do the 4th step.
26th Jul 2020, 3:56 AM
Swaraj Singh
Swaraj Singh - avatar