public class bintang{
public static void main(String[]args)throws Exception{
int x,y,z;
DataInputStream nilai = new DataInputStream(System.in);
System.out.print("Masukkan banyak deret segitiga : ");
String a = nilai.readLine();
int bil = Integer.valueOf(a);
System.out.println();
for (x = bil; x > 0; x--){
for (y = x-1;y > 0;y--){
System.out.print (" ");
}
for (z = x;z < bil+1;z++){
System.out.print("* ");
}
System.out.println();
}
}
}
tampilan output :
0 komentar:
Posting Komentar