[condition is always true , which means that the method will always return false ][1]
public class Primenumber {
public int number ;
public void saisie(){
Scanner sc = new Scanner(System.in);
System.out.print("donnez un un entier : ");
number = sc.nextInt();
}
public boolean isprime(){
for(int i=1 ; i <= number-1 ; i++ )
if(number%i ==0)
return false;
return true ;
}
} ```
Aucun commentaire:
Enregistrer un commentaire