Can You Figure this Out?

Problem :

My solution :

Can you please point out the error in my solution; I have used a very basic logic mostly you’ll understand it ! THANKS .

So simple, You are taking three(3) inputs where as input specifies only two(2). Why are you taking T number of test cases… Always read question twice before attempting it. Dont blindly post your doubts.

this code will work:-

    using namespace std;
    int main()
    {int t;
     int a,b;
     	    int n=a-b;
    return 0;

your logic is perfect only one mistake is there you are taking t that is number of testcases from user which is not required for this question see sample test case!

1 Like

Thanks for bringing the error into notice !