IITKESO207PA1 - Arithmetic Operations
In this question, you will be asked to implement 4 operations on two large natural numbers. The operations are as follows:
1) Add(a, b) : Compute a + b
2) Subtract(a, b) : Compute a - b. You are given that a > b
3) Multiply(a, b) : Compute a * b
4) Divide(a, b) : Compute a / b.
The first line contains t: the number of test cases.
t test cases follow
Each test case contains 3 lines:
The first line contains two space separated integers n1 and n2 denoting the number of digits in the two numbers.
The second line contains the two space separated sequences a and b of n1 and n2 digits respectively.
The third line contains the opcode. If the opcode is 1, then the output should be the result of Add(a, b), if 2 then Subtract(a, b), if 3 then Multiply(a, b) and if 4 then Divide(a, b).
For each test case, print the corresponding output on a new line
1 <= t <= 10
10 <= n1, n2 <= 1000