Rhombus Patern java program

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();

          char c = sc.next().charAt(0);

for(int i=1;i<=n;i++)
           {

                    for(int j=1;j<=n-i;j++)
            
                    {
                           System.out.print(" ");
                    }
     if(i==1 || i==n)
                   for(int j=1;j<=n;j++)
            
                    {
                           System.out.print(c);
                    }
               else
    {
            	       for(int j=1;j<=n;j++)
            
            	       {  
                        		if(j==1 || j==n)
                           	System.out.print(c);
                          	else
                         
                        	               System.out.print(" ");
                               }
                 }
                        System.out.println();
                   
           }             


            
}

}

many test case not pass ,please hepl me

@SanjeevKumarRay,

char to be printed will always be ‘*’ as given in the question

https://ide.codingblocks.com/s/219481 Corrected code.

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.