-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwhile23.java
More file actions
29 lines (25 loc) · 568 Bytes
/
while23.java
File metadata and controls
29 lines (25 loc) · 568 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
package whileGita;
import java.util.Scanner;
public class while23 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int a;
int b;
System.out.print("A:");
a = scanner.nextInt();
System.out.print("B:");
b = scanner.nextInt();
while ((a != 0) & (b != 0))
{
if (a > b)
{
a = a % b;
}
else
{
b = b % a;
}
}
System.out.print(a + b);
}
}