My pattern is coming out the same as req. but i answer not correct. Please tell where is MY CODE WRONG


This is the code. Please tell me where is my code wrong. Don’t give the solution please check my solution too

hi @akshat1409
Apologies for delayed response. Have a look at the corrected code–>

#include<iostream>
using namespace std;
int main() {
	int n;
    cin>>n;
	int numo= n ;
	int nums=1;
	for(int i=0;i<n;i++){
		for(int sp=0;sp<i;sp++){
			cout<<"  ";
		}
		for(int no=0;no<=n-i;no++){
			cout<<numo--<<" " ;

		}
		for(int noot=0 ; noot<n-i;noot++){
            cout<<nums++<<" " ;
		}
        cout<<endl;
        numo=n-i-1;
        nums=1;

	}
	for(int midzero=0;midzero<n;midzero++){
        cout<<"  ";
	}
	cout<<"0"<<endl;
	//upper half done with middle 0
	int sspa=n-1;
	int finalnum=1;
	int lfnoo=1;
	for(int lrow=1;lrow<=n;lrow++){
        for(int nsp=1;nsp<=sspa;nsp++){
            cout<<"  ";
        }
        for(int fino=0;fino<=lrow;fino++){
            cout<<finalnum--<<" " ;
        }
        for(int lfno=1;lfno<=lrow;lfno++){
            cout<<lfnoo++<<" " ;
        }
        sspa=sspa-1;
        finalnum=lrow+1;
        lfnoo=1;
        cout<<endl;
	}


    return 0;
}

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.