// Note: Java program is built on NetBeans IDE 8.2. OS Windows 8 or Windows 10.
// This is a sample of the simple programming in Java for beginners.
//----------------------------------------------------------------------------------------------------------------
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package CalcPrime;
import java.util.Scanner;
/**
*
* @author TSL
*/
class CalcPrim
{
/**
* @param args the command line arguments
*/
public static void main(String[] args){
// TODO code application logic here Scanner Reader
int i = 2;
Scanner scan = new Scanner(System.in);
Scanner user_input = new Scanner(System.in);
System.out.println("ENTER VALUE");
int n;
n = scan.nextInt();
while (i<= (n-1))
{
if (n % i == 0)
{
System.out.println("value is not a prime");
break;
}
else
{
System.out.println("value is prime");
}
}
}
}
No comments:
Post a Comment