In the code below, why am I not able to print the elements of vector? Not even their size. Can you please explain the reason?
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k=2;
    cin>>n;
    vector< int >v;
    while(n!=0){
        if((n%k==0)&&(k<10)){
            n=n/k;
            v.push_back(k);
        }
        else if((n%k!=0)&&(k<10)){
            k++;
        }
    }
    cout<<v.size()<<"\n";
    for(int i=0;i<v.size();i++){
        cout<<v[i]<<" ";
    }
}
 
    