LCM
public class LCM{ public void printLcm(int n,int m){ System.out.println(findLcm(n,m)); } public int findLcm(int n,int m) { int temp=n; while(true) { if(temp%n==0 && temp%m == 0) { break; } temp++; } return temp; } }
0 Comments