90% Discount Hostinger Coupon 1CODERX53
896+ Capstone Project is Available: Whatsapp: +91-7011258995, Email: sharecodepoint@gmail.com

How to find the prime number and not a prime number using java program

How to find the prime number and not a prime number using java program

Program to find the prime number and not a prime number using java program

import java.util.*;

public class Main{

public static viod main(String arrg[]){

int num = 29;
boolean flag;
for (int i =2 ; i<=num/2; i++){

if (num % i ==0)
{
flag = true;
break;
}
}

if (!flag){
System.out.println("Prime number);
}

else{
System.out.println("Not a Prime number);
}
}
}

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form