Number pyramid doubt

How would you write the same program using for loop ?

#include
using namespace std;

// Printing Number Pyramid
/*
1
123
12345
1234567
123456789
*/

int main() {

int n;
cin>>n;

int i = 1; // i denotes the row no 
while(i<=n){
    
    //Spaces 
    int space = 1;
    while(space<=n-i){
        cout<<" ";
        space = space + 1;
    }
    
    //Numbers 
    int no = 1;
    while( no<= 2*i - 1){
        cout<<no<<"";
        no = no  + 1;
    }
    
    //Print Endl
    cout<<endl;
    
            
    //Update the Row  Count 
    i = i + 1;
}

return 0;

}

#include
using namespace std;

int main() {

int n;
cin>>n;

int i = 1; // i denotes the row no
for(;i<=n;i++){

//Spaces 
int space = 1;
for(;space<=n-i;space++) {
    cout<<" ";
}


//Numbers 
int no = 1;
for( ;no<= 2*i - 1;no++){
    cout<<no<<"";
}

//Print Endl
cout<<endl;

}

return 0;
}