#include
using namespace std;
int main(){
int n;
cin>>n;
int i;
for(i=1;i<=n;i++){
for(int spaces =1;spaces<=n-1;spaces=spaces+1){
cout<<" ";
}
int val = i;
for(int cnt = 1;cnt<=i;cnt++){
cout<<val;
val=val+1;
}
val = val-2;
for(int cnt = 1;cnt<=i-1;cnt++){
cout<<val;
val=val-1;
}
cout<<endl;
}
i am not getting any spaces in my output
please review my code