#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;
}
}
Tell me the error so that pattern can be traced
Hello @Madhavendra-Gupta-2240591552663161,
Please, share your code using Coding blocks IDE.
The way you have shared it, introduced many syntax errors in the code.
Steps:
- Paste your code on online Coding Blocks IDE.
- Save your code there.
- Share the URL generated.