Respected Ma’am / Sir
I am getting an error in my code of pattern 4
Can you Please help me where my code is incorrect .
My Code is Given Below ;
package Lecture1;
import java.util.Scanner;
public class Pattern42m {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt() ;
int nsp = n-1 ;
int nst= 1 ;
// row
int row =1 ;
while (row<= n) {
// space work
int csp = 1;
while (csp <= nsp ) {
System.out.println(" ");
csp++ ;
}
// stars work
int cst = 1 ;
while ( cst <= nst ) {
System.out.println("*");
cst ++ ;
}
// prep
System.out.println();
nst++ ;
nsp = nsp - 1;
row++ ;
}
}
}