I wrote my own program of this code, but I'm not getting any results. Could you perhaps explain where I went wrong?

import java.util.Scanner;
public class pattern21 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n>0){
int counter=0;
int k=0;
while(counter<n-1){
System.out.print(" “);
counter++;
k=counter;
}
int a=n-k;
while(a-1>0){
System.out.print(”*");
a–;
}
System.out.print("\n");
n–;
}
}
}

@sairoshitkasam_86b2e085a0f53fab your code is not in readable form. Kindly add ‘’’ before and after your code in the text section here so that spaces are proper and readable.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.