Make it Divisible Scored Problem Code: MAKEDIV3

Hello ! Can someone please suggest whats wrong in my code? I am getting wrong answer.

#include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while (t–){
int n;
cin>>n;
int k;
if (n>1){
k=pow(10,n-1)+1;
while (true){
k+=2;
if (k%3==0 && k%9!=0){
break;
}
}
cout<<k<<endl;
}else{
cout<<3<<endl;
}
}
return 0;
}