لعبة المزرعة السعيدة لعبة الفراخ

greatest common divisor

 Example : 

** greatest common divisor **

_______________________________________________
* solution : 
import java.util.Scanner;
public class GCD {
public static void main (String [ ]args){
Scanner in = new Scanner (System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.println(" shosmo equals "+ gcdivisor(a,b));
}
public static int gcdivisor(int x , int y ){
int i=1;
int gc=1;
while (i<=x&&i<=y){
if(x%i==0&&y%i==0)gc=i;
i++;
}
return gc;
}
}


0 التعليقات:

لعبة من سيربح المليون لعبة زوما