import java.util.Scanner;

public class LeastCommonMultiple {
	public static long lcm(int a, int b) {
		if (a == 0 || b == 0) {
			return 0;
		}
		if (a == b) {
			return a;
		}
		long smallerValue = a < b ? a : b;
		long biggerValue = a < b ? b : a;
		for (long i = 1; i < smallerValue * biggerValue; i++) {
			if (i * smallerValue % biggerValue == 0) {
				return i * smallerValue;
			}
		}
		return a * b;
	}

	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		System.out.println(lcm(a, b));
	}
}

@@ -177,174 +177,92 @@
 %7D%0A%09%09
-long smallerValue = a %3C b ? a :
+return (long) a * b / gcd(a,
  b
+)
 ;%0A%09
-%09long biggerValue = a %3C b ? b : a;%0A%09%09for (long i = 1; i %3C smallerValue * biggerValue; i++
+%7D%0A%0A%09private static int gcd(int a, int b
 ) %7B%0A
-%09
 %09%09if (
-i * smallerValue %25 biggerValue
+b
  == 
@@ -266,17 +266,16 @@
 == 0) %7B%0A
-%09
 %09%09%09retur
@@ -280,30 +280,10 @@
 urn 
-i * smallerValue;%0A%09%09%09%7D
+a;
 %0A%09%09%7D
@@ -291,22 +291,30 @@
 %09%09return
+ gcd(b,
  a 
-*
+%25
  b
+)
 ;%0A%09%7D%0A%0A%09p

Optimize the algorithm