akvs
unknown
java
2 years ago
831 B
6
Indexable
import java.util.Scanner; public class p1 { public static void main(String[] args) throws Exception { Scanner read_ip = new Scanner(System.in); int i, j, p, q, input; input = read_ip.nextInt(); p = 1; q = input; for(i = 1; i <= input; i++) { for(j = 1; j <= input; j++) { if(j < p) { System.out.print(" "); } else if((j >= p) && (j <= q) || (i == j)) { System.out.print("* "); } else if(j > q) { System.out.print(" "); } } if(i <= (input)/2) { q--; p++; } else { q++; p--; } System.out.println(); } } }
Editor is loading...