My issue
help
My code
#include <iostream>
using namespace std;
int main() {
// your code goes her
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
int ans=0;
if(n%k==0)
ans=0;
else{
while(n>0)
{
ans=n%k;
n=n/k;
}
}
cout<<ans<<endl;
}
return 0;
}
Learning course: Level up from 1* to 2*
Problem Link: CodeChef: Practical coding for everyone