Test cases failed even program is giving correct result

I solved Pascal Triangle 1 question and checked at every value program gives correct result on sublime text. But here when I submit, it failed test cases. Why ?

hi @di5n7u_f87e18903cba617b refer,

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	
	for(int i=1;i<=n;i++){
		int num=1;
		for(int j=1;j<=n-i+1;j++){
			cout<<" ";
		}
		
		for(int j=1;j<=i;j++){
			if(j==1){
				cout<<j<<" ";
			}
			else{
				num=num*(i-j+1)/(j-1);
				cout<<num<<" ";
			}
		}
		cout<<endl;
	}
}

But why is my program not passing the test cases? Even if it gives the correct output. I have shared the link to the program and the output file of it. Please help me to find where the error is in it.

Program link

Input
10

Output screenshot

Output file link
file:///C:/Users/hp/output.txt

hi @di5n7u_f87e18903cba617b there is a space in last row in start

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.