**************kth root

for all test cases the output is coming same as of 1st test case

#include
#include<math.h>
using namespace std;
int main()
{ int k,ans;
long long int no,n;
//cin>>no;
//cin>>p;
//cin>>k;
int s=0;
int e=no;
cin>>n;
pair <long long int,int>input[n];
int m;
//float ans;

for(int i=0;i<n;i++)
{   cout<<"no,k";
    cin>>no>>k;
    input[i].first=no;
    input[i].second=k;
}

/float inc=0.1;
for(int i=0;i<p;i++){
while(pow(ans,k)<=no){
ans+=inc;
}
ans=ans-inc;
inc=inc/10;
}
/

for(int i=0;i<n;i++)
{
    while(s<=e){
    m=(s+e)/2;
    if(pow(m,input[i].second)==input[i].first){
        ans=m;
        //cout<<ans;
        break;
    }
    else if(pow(m,input[i].second)<input[i].first)
    {
        s=m+1;
        ans=m;
        //cout<<ans;
        //break;
    }
    else if(pow(m,input[i].second)>input[i].first){
        e=m-1;}
}
    cout<<ans<<endl;

}

return 0;}

Hi @ayu2321

I have made some minor changes in your code, it is working now.
Link : https://ide.codingblocks.com/s/199511

Hope It Helps.

what is the mistake in my code??

there were some variables that were not inititalised and were assuming garbage values. And some other minor mistakes too. You can compare the code i have with your previous code. I have made minor changes only on that. You will be able to figure it out.

Hope it helps.

@ayu2321
Please mark your doubt as solved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.