+ 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
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.