mam i didnt get the output which you got i’m not understanding where is the mistake
package patterns;
import java.util.Scanner;
public class pat6 {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int row=1;
int nsp=0;
int nst=n;
while(row<=n) {
int i=1;
while(i<=nsp) {
System.out.print(" ");
i++;
}
int j=1;
while(j<=nsp) {
System.out.print("*");
j++;
}
System.out.println();
nst=nst-1;
nsp=nsp+1;
row=row+1;
}
}
}
This is my code mam
5
**
****
I got output like this mam im not getting required pattern .Can you tell me what was my mistake mam.