-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFun48.java
More file actions
36 lines (35 loc) · 859 Bytes
/
Fun48.java
File metadata and controls
36 lines (35 loc) · 859 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
34
35
36
package fun;
public class Fun48 {
public static void main(String[] args) {
System.out.println (EKUB (6, 8));
EKUK (6,8);
}
public static int EKUB(int a,int b){//24 va 18
int max=Integer.MIN_VALUE;//
int t,m=0,e=0;
int tb,mb=0;
for (int i = 1; i <= a; i++) {
t=a%i;//
if (t==0){
m=i;
}
for (int j = 1; j <=b ; j++) {
tb=b%j;//
if ( tb==0 ){
mb=j;
}
if ( m==mb ){
e=m;
}
if (max<e ){
max=e;
}
}
}
return max;//max=>18
}
public static void EKUK(int g,int h){
int p=g*h/EKUB (g,h);
System.out.println (p);
}
}