Computer Science, asked by izzupro3232, 2 months ago

Write a program to check whether a number is prime or not using for loop. JAVA
STD X
PLEASE ANSWER FAST
FASTEST ANSWER WILL BE MARKED BRAINLIEST​​

Answers

Answered by mahienterprisesgrd
1

public class PrimeExample{

public static void main(String args[]){

int i,m=0,flag=0;

int n=3;//it is the number to be checked.

m=n/2;

if(n==0||n==1){

System.out.println(n+" is not prime number");

}else{

Explanation:

In this java program, we will take a number variable and check weather the number is prime or not.

Similar questions