Pattern Number And Star 1

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= 2
n-2; j++) {
if(j<=n+1-i)
System.out.print(j+" ");

		   if(j<=n-2+i && j>=n+2-i)
			   System.out.print("*"+" ");
			   else
			   System.out.print(" ");
		 
   
		}
		System.out.println();
	}
}

}
//only 80 marks are being given
where as the logic is correct for all the inputs plz guide me if there is any problem related to my logic

Hii Nirmal,
See the correct logic for this problem is:
nst = 1
nsp = n - 1
If row == 1
Print the numbers 1 to n where n is the total no. of row
Else
Print the numbers from 1 to bsp and then print no. of stars equal to bat

After this increase nst by 2
And then decrease nsp by 1

Hi Nirmal, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.