-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
33 lines (25 loc) · 787 Bytes
/
Main.java
File metadata and controls
33 lines (25 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
class EbobEkok {
public static int ebob(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
public static int ekok(int a, int b) {
return (a * b) / ebob(a, b);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Birinci sayıyı girin: ");
int sayi1 = scanner.nextInt();
System.out.print("İkinci sayıyı girin: ");
int sayi2 = scanner.nextInt();
int ebobSonuc = ebob(sayi1, sayi2);
int ekokSonuc = ekok(sayi1, sayi2);
System.out.println("EBOB: " + ebobSonuc);
System.out.println("EKOK: " + ekokSonuc);
}
}