[code] Java membuat Bintang menjadi Segitiga berurut Part. 2

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Bintang;

/**
 *
 * @author FIQI
 */
import javax.swing.*;
public class Bintang2 {
    public static void main (String[] args)
    {
    int baris,x,y;
    baris=Integer.valueOf(JOptionPane.showInputDialog("Masukkan Banyak Bintang ?"));
    x=baris+1;
    for (int i=1;i<=baris;i++){
        for (int j=1;j<=baris;j++){
            y=i+j;
           if (y<=x)
               System.out.print("*");
           else
               System.out.print(" ");
            }
       System.out.println();
    }
    }
    }

0 komentar:

Posting Komentar

: Ayoo sharingg.. :D

Related Posts Plugin for WordPress, Blogger...

Sponsor

Banner

Ayo kita tukar - tukaran banner : my code banner :
ImagineWorld
and my friend :