MàJ par récupération sur Clé USB et dans /mnt/hd/Chargement du pc portable

This commit is contained in:
olivier
2008-12-02 23:56:33 +01:00
parent 3e719157ea
commit 5b95264a14
196 changed files with 12561 additions and 10316 deletions

View File

@ -0,0 +1,26 @@
import javax.swing.JOptionPane;
class Premier { // Determine si un nb est premier ou non
public static void main (String[] args) {
String nb,reponse ;
int n;
boolean premier;
nb=JOptionPane.showInputDialog("tapez votre nombre");
n=Integer.parseInt(nb);
while (n!=0) {
premier = true;
if (n==1) {JOptionPane.showMessageDialog(null,"1 n'est pas premier par convention ");
premier=false;}
for (int i=2;i<n; i++) {
System.out.println(n+" "+i+" "+n%i);
if (n%i==0) {
JOptionPane.showMessageDialog(null,n+" n'est pas premier :multiple de "+ i);
premier=false;
break;}
}
if (premier)JOptionPane.showMessageDialog(null,n+" est un nb premier ");
nb=JOptionPane.showInputDialog("tapez votre nombre");
n=Integer.parseInt(nb);
}
System.exit(0);
}
}