MAKEDIV3 Make it Divisible Problem Code: MAKEDIV3SolvedSubmit Given an integer N

#include
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
if(n==1)
cout<<“3”<<endl;
else if(n==2)
cout<<“15”<<endl;
else{
//sum=6
cout<<“2”;
for(int i=1;i<=n-2;i++)
cout<<“1”;
cout<<“3”<<endl;
}
}
return 0;
}
please-tell-what-is-wrong-in-this?

for n>2 if u want to make the sum of digits 6 using 1,2 and 3, you will also need to include 0
you can change the last else block to

else{
//sum=6
cout<<“21”;
for(int i=1;i<=n-3;i++)
cout<<“1”;
cout<<“3”<<endl;
}

So the output should be
213
2103
21003
210003 and so on

whereas currently the output is
213
2113 //not divisible
21113 …

MAKEDIV3-CodeChef

#include
#include<math.h>
using namespace std;

int main()
{ long long tc;
cin>>tc;
while (tc–)
{
int n; cin>>n; int k;
if (n==1)
{ k=3;
cout<<k<<endl;
}

else{
  cout<<5+pow(10,n-1)<<endl;
}

}

return 0;

}

whats wrong with my code? it seems pretty simple, am I missing something??