Pattern numbers & stars - 2

In the above question, I believe that I have coded correctly as in my compiler it is showing the desired result but the answer is not being submitted. It shows " wrong answer". Please check and verify-

#include
using namespace std;
int main() {
int i,j,N,k;
cout<<"Enter the no. of rows: " << endl;
cin>> N;

for(i=1;i<=N;i++)
    {
        for(j=1;j<=i;j++)
            {
            	cout<< j;
            	
        }
	
	
		for(k=N;k>=j;k--)
                	{
                		cout<< "*";
                		
					}
				cout<< " " << endl;
            }
            
            
    

return 0;

}

Hey Divyam, your code is correct its just that your output should exactly match the given output format or the problem. So, remove cout<<"Enter the no. of rows: " << endl; line from your code.

#include <stdio.h>

int main()
{
int i, j, n;

scanf("%d", &n);

// Loop to print upper half of the pattern
for(i=1; i<=n; i++)
{
    for(j=i; j<=n; j++)
    {
        printf("*");
    }

    for(j=1; j<=(2*i-2); j++)
    {
        printf(" ");
    }

    for(j=i; j<=n; j++)
    {
        printf("*");
    }

    printf("\n");
}

// Loop to print lower half of the pattern
for(i=1; i<=n; i++)
{
    for(j=1; j<=i; j++)
    {
        printf("*");
    }

    for(j=(2*i-2); j<(2*n-2); j++)
    {
        printf(" ");
    }

    for(j=1; j<=i; j++)
    {
        printf("*");
    }

    printf("\n");
}

return 0;

}
this is my code for PATTERN MAGIC and it is giving wrong test case