import javax.swing.*;
public class tugas_bintang {
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 (x<=y)
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
}
Tidak ada komentar:
Posting Komentar