import java.util.Scanner; public class LcmOfTwoNumber { public static void main(String[] args) { int a, b, c, d; Scanner in = new Scanner(System.in); System.out.println("the value of a:"); a = in.nextInt(); System.out.println("the value of b:"); b = in.nextInt(); if (a > b) { c = a; d = b; } else { c = b; d = a; } for (int i = 1; i < c; i++) { if (((c * i) % d) == 0) { int lcm = c * i; System.out.println("The lcm of two number is " + (lcm)); break; } } } }