+ 1

Accept a number in base case and check it is prime or not

1- derived class no is divided by 3& 7 2- palindrome of a number

23rd Sep 2017, 2:35 PM
Babu Raju
Babu Raju - avatar
1 Respuesta
+ 3
If you're saying you want to make a method in java that checks if a number is prime or not, here's a way: public boolean isPrime(int number) { for (int i = 2; i < number; i++) { if (number % i == 0) return false; } return true; } This method returns true if the integer parameter is prime and returns false otherwise.
2nd Jun 2019, 2:20 PM
androidCoder255
androidCoder255 - avatar