Java Saved Program: placid-rain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


import java.util.*;
class prime
{
public static void main(String[] args)
{
Scanner sc= new Scanner(Stystem.in);
System.out.println ("enter the no:=    ");
int s=sc.nextInt();
int i;
for (i=2;i<a;i++){
 if(a%i==0)
 {
 System.out.println("given number is not a prime number");
 break;
 }
 }
 if(i==a)
 System.out.println("given number is a prime number");
	}
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs