Tabel ganda

Assalamualaikum, .
Sebelumnya saya membagikan cara konversi kilogram ke pound, kali ini saya pakai tabel ganda, .
Selamat mencoba, .

public class DoubleTable {

public static void main(String[] iriahus) {
final double POUND_TO_KG = 0.454;
final double KG_TO_POUND = 2.205;
final int COUNT = 200;
int i = 1;
int j = 20;

System.out.println("Kilograms\tPounds  |  Pounds\tKilograms");
System.out.println("----------------------  |  ----------------------");

while (i < COUNT) {
System.out.printf(i + "\t  %12.3f  |  " + j +
"\t     %12.3f\n", (i * KG_TO_POUND), (j * POUND_TO_KG));
i += 2;
j += 5;
}
}

}

Semoga bermanfaat, . .

Subscribe to receive free email updates:

0 Response to "Tabel ganda"

Post a Comment