We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b09111f commit 744dc9aCopy full SHA for 744dc9a
Easy/GCF.java
@@ -0,0 +1,28 @@
1
+import java.util.*;
2
+import java.io.*;
3
+
4
+class Main {
5
6
+ public static int GCF(int[] arr) {
7
+ // code goes here
8
+ int sayac=1,gfc=0;
9
10
11
+ while ( sayac <= arr[0]){
12
13
+ if ( arr[0] % sayac==0 && arr[1]%sayac==0) gfc=sayac;
14
15
+ sayac++;
16
+ }
17
18
+ return gfc==0 ? 1 : gfc;
19
20
21
22
+ public static void main (String[] args) {
23
+ // keep this function call here
24
+ Scanner s = new Scanner(System.in);
25
+ System.out.print(GCF(s.nextLine()));
26
27
28
+}
0 commit comments