Computer Science, asked by soumyajitpramanik51, 7 months ago

Write a function to accept a value through the parameter and return Boolean result ‘true’ if the

inputted value is a prime number, otherwise return ‘false’.


One who solves it..will be marked as brainliest and also get 50 thanks...for sure...​

Answers

Answered by vkgohil1977
1

Explanation:

public static void main(String args []){

Scanner input = new Scanner(System.in);

int number;

int i;

int a;

System.out.println("Enter number");

number = input.nextInt();

for(i = 1; i < (number + 1); i++){

if(number % i==0){

a++;

}

}

System.out.println(prime(m));

}

public static boolean prime(boolean m){

boolean m = false;

if(a!=2){

return m;

}else{

return m = true;

}

}

Similar questions