Kamis, 05 Juni 2014

Perulangan while dasar


public class pertemuan6 {
    public static void main (String [] args) throws IOException {
        int x= 1;
        int jumlah;
        BufferedReader baca = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("masukan jumlah= ");
        jumlah = Integer.parseInt(baca.readLine());
    
        while (x <= jumlah) {
            System.out.println(x);
            x++;
          
        }
    }

}


Tidak ada komentar:

Posting Komentar