ERROR3-EDITORIAL

PROBLEM LINK:

Practice

Author: Abhijeet Trigunait
Tester: Abhijeet Trigunait
Editorialist: Abhijeet Trigunait

DIFFICULTY:

CAKEWALK, SIMPLE, EASY.

PREREQUISITES:

Simple Arithmetic calculations.

PROBLEM:

Given two numbers A and B, if A is greater then B , then output the difference of the two numbers and if B is greater then A output product of the two numbers, else if A and B both are equal output sum of the two numbers.

EXPLANATION:

Just a simple calculation.
if(A>B) print A-B;
else if(B>A) print A*B;
else print A+B;

SOLUTIONS:

Setter's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin>>tc;
while(tc--){
int a,b;
cin>>a>>b;
if(a==b)cout<<a+b<<endl;
else if(a>b)cout<<a-b<<endl;
else cout<<a*b<<endl;}
return 0;
}  
1 Like