- Java Online Training In Andhra Pradesh and Telangana

Opening Hours :7AM to 9PM

Here is a simple program that checks whether a given number is a Keith number or not:

The program outputs "145 is a Keith number." because 145 is indeed a Keith number (1! + 4! + 5! = 145).import java.math.BigInteger; class KeithNumber { // utility function to compute the factorial of a number public BigInteger factorial(int n) { BigInteger f = BigInteger.ONE; for (int i = 2; i <= n; i++) { f = f.multiply(BigInteger.valueOf(i)); } return f; } } public class Main { public static void main(String[] args) { KeithNumber kn=new KeithNumber(); int n = 145; // number to be checked // compute the factorials of the digits of n BigInteger sum = BigInteger.ZERO; for (char c : String.valueOf(n).toCharArray()) { int d = Character.getNumericValue(c); BigInteger f = kn.factorial(d); sum = sum.add(f); } // check if n is equal to the sum of its factorial digits if (n == sum.intValue()) { System.out.println(n + " is a Keith number."); } else { System.out.println(n + " is not a Keith number."); } } }

- 13 . Sunny Number in Java

- 14 . Tech Number in Java

- 15 . Keith Number in Java

- 16 . Neon Number in Java

- 17 . Spy Number in Java

- 18 . ATM program Java

- 19 . Emirp Number in Java

- 54 . Write a Java program to count the letters, spaces, numbers and other characters of an input string

- 100 . Write a Java program that takes a year from user and print whether that year is a leap year or not

- Duaration(Core & Advanced) : 90 Hours
- Leactures : 90
- Quizzes : 60
- Interview Questions : 600
- Important Programs: 300
- Seminars: 20