Challenges - Pattern with Zeroes

I have submitted the correct code and still it is saying “all test cases are failed”.

#include
using namespace std;
int main() {
int n;
cin>>n;
for(int i=0; i<n; i++){
for(int j=0; j<=i ; j++){
if(j==0){
if(i==0)
{
cout<<i+1<<endl;
}
else{
cout<<i+1;
}
}
else if(j==i){
cout<<i+1<<endl;
}

		else{
			cout<<0;
		}

	}

}
return 0;

}

I am still nat able to understand what is the issue

I am still nat able to submit the code it is saying test cases are failed

Your code has an error in the logic for printing zeros. Instead of printing a space, you are printing a zero in the middle of each row, causing extra zeros in the output pattern.

You can reefer my code

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.

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.