Why my code give time limit error

#include
using namespace std;
int main() {
int N,no;

cin>>N;
while(N>0){
	cin>>no;
          int k=3;
	for(int i=1;i<=no-1;i++){
             

		 
		for(int j=2;j<=k-1;j++){
			if(k%j==0){
			no=no+1;
			break;
			}
			
			}
        
			
        
        k=k+1;
		}
		k=k-1;

  if(no>1){
	  cout<<k<<endl;
  }
  else
  cout<<"2"<<endl;


  N=N-1;
	}

 





return 0;

}