i am note able to print the exact pattern. tell me what should i edit in my code.
#include
using namespace std;
int main()
{
int n,i=1;
cin>>n;
while(i<=n)
{
int space=n-i;
while(space>0)
{
cout<<" ";
space=space-1;
}
int no=1;
while(no<=(2i)-1)
{
if(no==1||i==1||no==(2i)-1)
cout<<i;
else
{
cout<<i+1;
}
no=no+1;
}
cout<<endl;
i=i+1;
}
}