/*
* Main.java
*
* Created on 27 Μάρτιος 2008, 3:28 μμ
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*
* Sto parathiro dinw enan arithmo
* Mou emfanizei ton proto arithmo pou
* einai plisiesteros autou pou edwsa
*/
package protos;
import javax.swing.JOptionPane;
import java.util.Calendar;
/**
*
* @author students
*/
public class Main {
static String input(){
return JOptionPane.showInputDialog(null, "Give me a number: ");
}
static void message(String x){
JOptionPane.showMessageDialog(null, "O " + x + " einai prwtos arithmos!");
}
static void message1(String x){
JOptionPane.showMessageDialog(null, "Plisiesteros einai o " + x + " !");
}
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String in = input();
int num = Integer.parseInt(in);
int i, j, flag=0;
int rem=0, arithmos = 1;
for (i=num;i>1;i--){
flag = 0;
for (j=2;j<i;j++){
rem = i%j;
if (rem==0){
flag = 1;
break;
}
}
if (flag==0){
arithmos = i;
}
if(arithmos!=1){
break;
}
}
if (arithmos == num){
message("" + arithmos);
}
else{
message1("" + arithmos);
}
System.exit(0);
}
}