/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pkgfor; import java.util.Scanner; /** * * @author Muh. Misbahul Munir */ public class For { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner scn = new Scanner(System.in); //membuat objek input baru System.out.print("Masukkan panjang bilangan: "); int d = scn.nextInt(); //variabel input d dengan tipe data int System.out.println("Perulangan bilangan: "); for (int i = 0; i <= d; i++) //perulangan { System.out.print(" " + i); //menampilkan hasil perulangan } } }