C++ Exception Handling
Submissions: 1720   Accuracy:

27.61%

  Difficulty: Easy   Marks: 2

Given two integers (positive , negative or even 0) say a and b. Find the max value of a$b where $ is any arithmetic operation like multiply(*), Divide(/), Addition(+),Substraction(-). Use Exception Handling in this problem.

Input: 
The first line will contain an integer (number of test cases). Each test case will contain two integers a and b.

Output: 
Print the max value of a$b.

Constraints: 
1 < = T < = 100
-103<=a,b<=103

Example:
 Input:

2
5 -5
4 0

Output:
10
inf

EXPLANATION:

In test case 1: 5-(-5) = 10
In test case 2: 4/0 = Infinite

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: S_A
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.