Write the java program to find LCM | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Write the java program to find LCM

22nd Oct 2017, 2:23 PM
Saikrishna
2 Respostas
+ 2
// Java import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); int result = 0; for(int i = 1; i < num; i++){ if(num%i==0){ result = i; } } System.out.print("LCM: "+result); } }
22nd Oct 2017, 7:18 PM
Ferhat Sevim
Ferhat Sevim - avatar
22nd Oct 2017, 3:34 PM
#RahulVerma
#RahulVerma - avatar