Nia
// Salut ami, voici votre programme. Mais s'il vous plaît Re compilez-le, je ne l'ai pas compilé directement écrit ici.
Importer java.io.DataInputStream ;
class Prime{
public static void main(String[]ar){
int I=1,num=0;
DataInputStream this=new DataInutStream(System.in);
booléen Succès=false ;
System.out.println("Entrez n'importe quel nombre :");
while(!Success){
try{
num=Integer.valueOf(this.readLine());
Succès=vrai ;
}
catch(Exception E){
System.out.println(E +"nReEnter Number");
}
}
calc NW=nouveau calc();
int Pr=0;
pour (I=1;I<=num;I++){
Pr=NW.GetPrime(I);
if (Pr>0)
System.out.print("t" + Pr);
}
}
}
class calc{
int GetPrime(int num){
int I=0;
pour (I=2;I<num;I++){
if (num%I==0){
return 0;
}
}
return num;
}
}