Programme PGCD en java
bonjour,
voilà j'ai fais le programme pour trouver le pgcd de deux nombre mis en argument et j'aimerais savoir si je suis dans le vrai.
public class Pgcd {
public static void main (String [] arguments) {
int a = Integer.parseInt(arguments[0]);
int b = Integer.parseInt(arguments[1]);
System.out.println("pgcd(" + a + "," + b + ") = " + pgcd(a,b));
}
static int pgcd (int a, int b) {
if(a%b==0)
System.out.println("PGCD="+b);
else
a%b=r;
a=b;
b=r;
}
}
merci
voilà j'ai fais le programme pour trouver le pgcd de deux nombre mis en argument et j'aimerais savoir si je suis dans le vrai.
public class Pgcd {
public static void main (String [] arguments) {
int a = Integer.parseInt(arguments[0]);
int b = Integer.parseInt(arguments[1]);
System.out.println("pgcd(" + a + "," + b + ") = " + pgcd(a,b));
}
static int pgcd (int a, int b) {
if(a%b==0)
System.out.println("PGCD="+b);
else
a%b=r;
a=b;
b=r;
}
}
merci