I think my logic is wrong ? Can you please help me to correct this code

void Test(int n)
{
int M,N;

for(int i=1;i<=n;i++)
{
    cin>>M>>N;
    int val=0 , temp=0;
    int sphone , tphone;
    while(M > temp || N>val)
    {
        cin>>sphone;
        temp=sphone+temp;
        cin>>tphone;
        val=tphone+val;
    }
    cout<<temp<<endl;
   
    
    cout<<val<<endl;
     if(temp > M )
    {
        cout<<"Harshit"<<endl;
    }
   
    if(val>N)
    {
        cout<<"Aayush"<<endl;
    }
}

}
int main()
{
int n;
cin>>n;
Test(n);
return 0;
}

hi @deepshreyamishra301_1918130c8477386b, refer here https://ide.codingblocks.com/s/660264

why you should used the condition t-- with the while loop .

@deepshreyamishra301_1918130c8477386b that is for no of test cases while t>0 it will run and everytime it will reduce t by 1

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.