Pattern mountain doubt

question link
https://online.codingblocks.com/player/11915/content/4766?s=1493
my code
#include
using namespace std;
int main()
{
int n,k,j;
cin>>k;
for(n=0;n<k;n++)
{
for(j=1;j<=(n+1);j++)
cout<<j;
for(j=(n+1);j<(((2k)-1)-n);j++)
cout<<" ";
for(j=(((2
k)-1)-n);j=((2*k)-1);j++)
cout<<j;
cout<<endl;
}
return 0;
}
what is the problem with my code

Hey!! your syntax is not correct as 2k is invalid for multiplying 2 and k you are supposed to write it as 2*k.
Also you are supposed to give ‘\t’(tab) instead of " "(space).

1 Like