Angka Genap Terbesar

Run Settings
LanguageJava
Language Version
Run Command
/** * Program : Cari bilangan genap terbesar * Date : 6 Juni 2022 * Author : Riyanto * Website : https://www.melonkoding.com */ import java.util.Arrays; class Main { private static int[] angka = {38, 100, 29, 10, 66, 27, 90, 133, 75, 12}; public static void main(String[] args) { System.out.printf("Deret angka: %s\n", Arrays.toString(angka)); int terbesar = 0; for(int i = 0; i < angka.length; i++) { if((angka[i] % 2 == 0) && (angka[i] > terbesar)) { terbesar = angka[i]; } } System.out.printf("Angka genap terbesar adalah %d", terbesar); } }
Editor Settings
Theme
Key bindings
Full width
Lines