Angka di Bagi 5 dan 6

Assalamualaikum, . .
Kali ini sya akan membagikan tentang looping, . .

public class NumDivisibleBy5And6 {

public static void main(String[] iriahus) {
final int NUM_PER_LINE = 10;
int count = 0;

System.out.println("The numbers divisible by 5 and 6 are: ");

for (int i = 100; i <= 1000; i++) {
if (i % 5 == 0 && i % 6 == 0) {
count++;

if (count % NUM_PER_LINE == 0) {
System.out.println(i);
} else {
System.out.print(i + " ");
}

}
}
}

}

Semoga bermanfaat, . .

Subscribe to receive free email updates:

0 Response to "Angka di Bagi 5 dan 6"

Post a Comment