Menampilkan N Angka Terakhir

Run Settings
LanguageJava
Language Version
Run Command
/** * Program : menampilkan N angka terakhir * Date : 16 Juni 2022 * Author : Riyanto * Website : www.melonkoding.com */ import java.util.Arrays; class Main { static int[] angka = {2, 1, 7, 6, 9, 4, 8, 5, 3, 10}; public static void main(String[] args) { int n = 4; System.out.printf("%d angka terakhir dari: %s\n", n, Arrays.toString(angka)); for(int i=0; i<angka.length; i++) { if((angka.length - i) <= n) { System.out.printf("%d ", angka[i]); } } } }
Editor Settings
Theme
Key bindings
Full width
Lines