#include
using namespace std;
int main(){
int N;
cin>>N;
int row;
int p=1;
int w=N+1;
for(row=1;row<=N;row++){
int val=N;
for(int i=1;i<=row;i++){
cout<<val;
val=val-1;
}
for(int space=1;space<=(2N+1-2row);space++){
cout<<" “;
}
val=val+1;
for(int i=1;i<=row;i++){
cout<<val;
val=val+1;
}
cout<<endl;
}
if(row==N+1){
int val=N;
for(int i=1;i<=N+1;i++){
cout<<val;
val=val-1;
}
val=val+2;
for(int i=1;i<=N;i++){
cout<<val;
val=val+1;
}
cout<<endl;
}
for(int row= N+2 ;row<=(2N+1);row++){
int val=N;
for(int i=1;i<=(row-p2);i++){
cout<<val;
val=val-1;
}
//spaces
for(int space=1;space<=(row-w);space++){
cout<<” ";
}
val=val+1;
for(int i=1;i<=(row-2*p);i++){
cout<<val;
val=val+1;
}
cout<<endl;
p = p+1 ;
w = (w - 1);
}
return 0;
}
Please help me find the error in my code.I am not able to fix the spacing error.please help me correct my code
now please help
still not able to fix spacing issues.please help and explain this
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.