can not able to code this problem
Section 1 practice problem number 20
package praticesec1; import java.util.Scanner; public class Pro20 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int nsp = n/2; int nsp2 = 1; for(int row =1;row<=n;row++) { // work for space for(int csp=1;csp<=nsp;csp++) { System.out.print(" “); } // work for star System.out.print(”* “); // work for space and star if(row != 1 || row !=n) { for(int csp =1;csp<=nsp2;csp++ ) { System.out.print(” “); } System.out.print(”* " ); } // preparation System.out.println(); if(row<=n/2) { nsp–; nsp2 +=2; } else { nsp++; nsp2 -=2; } } } }
@mayanktiwari6957 Bro if you have done all the patterns above then this hollow diamond pattern is very easy. What problem are you facing.