import jeliot.io.*; public class kpk { int a,b,nilai; public void masukan() { System.out.print("Menghitung KPK"); nilai=0; System.out.print("Masukkan A: "); a=Input.readInt(); System.out.print("Masukkan B: "); b=Input.readInt(); for (int z=1; z<=b; z++) { nilai=nilai+a; if (nilai%b==0) { System.out.print("KPK dari "); System.out.print(a); System.out.print(" dan "); System.out.print(b); System.out.print(" adalah "); System.out.print(nilai); } } } public static void main () { kpk X = new kpk(); X.masukan(); } }
0 Response for the "Least Common Multiple (LCM) in Jeliot"
Post a Comment