Prateek lovescandy

time limit exceeded in the code

#include using namespace std; int main() {int t,n; cin>>t; for(int j=0;j<t;j++) { cin>>n; int count=0,a=2; while(1){ if(count<n) { int i=2; if(ii>a) count++; while(ii<=a){ if(a%i==0) count++; i++; } } a++; } cout<<a-1; } return 0; }

save to your code to online ide of coding block AND POST the link here we will look into it

ur code stuck into an infinte loop in the first while loop
u have done
while(1)
ans there is no terminating condition