Array 1 Dimensi

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { int[] angka = {1, 4, 3, 8, 10, 47, 37, 4, 50, 37, 33, 98}; int ganjil = 0; int total = 0; for(int m = 0; m < angka.length; m++) { if(angka[m] % 2 == 1) { System.out.printf("%d ", angka[m]); ganjil++; } } // tampilkan jumlah angka ganjil System.out.println("\nAngka ganjil ada "+ ganjil); System.out.println("\nTotal angka ganjil adalah "+ total); } }
Editor Settings
Theme
Key bindings
Full width
Lines