package com.oop; import java.util.Scanner; public class Demo4 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int m = sc.nextInt(); int n = sc.nextInt(); int cm = getCM(m, n); System.out.println(cm); sc.close(); } public static int getCM(int m, int n) { for(int i = m>n?m:n; i <= m*n; i++) { if(i % m == 0 && i % n == 0) { return i; } } return -1; } }