Professional Documents
Culture Documents
Segitiga Tengahnya Bolong
Segitiga Tengahnya Bolong
println("Masukkan angka : "); Scanner input = new Scanner(System.in); n=input.nextInt(); a = n; e = n-1; for(c=1;c<=n;c++){ b = 1; for(d=1;d<=a;d++) { if (b<=e) { System.out.print(" "); b++; } else { if(d==b||d==a||e==0){ System.out.print("*"); }else System.out.print(" "); } } e--; a++; System.out.print("\n"); } } }