MARARUN - Beginners approach (If-else)

Problem 1:- CodeChef: Practical coding for everyone

#include

using namespace std;

int main() {

int T;cin>>T;

while(T--){

    //10 21 42

    int D, d, A, B, C, p;

    cin >> D>> d>> A>> B>>C;

    if((D*d)<10){

        cout<<0<<endl;

    }

    else if ((D*d)>=10 && (D*d)<21){

        cout<<A<<endl;

    }

    else if ((D*d)>=21 && (D*d)<42){

        cout<<B<<endl;

    }

    else {

        cout<<C<<endl;

    }

}

return 0;

}

  • Test Case 1:

Input:
3
1 1 1 2 3
10 1 1 2 3
10 3 1 2 3
Output:
0
1
2

  • Test Case 2: (Self-Created)

Input:
3
1 3 2 4 5
11 1 2 3 5
3 1 2 3 5
Output:
0
2
0