Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6420
@blackshadows 6376
@mb1973 5604
@Quandray 5231
@akhayrutdinov 5111
@saiujwal13083 4510
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Complete Leaderboard
C++ Operators | Set 1 (Arithmetic)
School Accuracy: 42.71% Submissions: 1491 Points: 0

Given two numbers A and B. Perform addition,multiplication, subtraction and division on these two numbers.

Example 1:

Input: A = 1,  B = 2
Output: 3 2 1 2
Explanation:
A + B = 3
A * B = 2
Since B>A, therefore the result of
subtraction and division are
B - A = 1 and B / A = 2 respectively.

Example 2:

Input: A = 5 B = 7
Output: 12 35 2 1
Explanation:
A + B = 12
A * B=35
Since B>A, therefore results of subtraction
and division are B - A = 2 and B / A = 1.


Your Task:
You don't need to read input or print anything.Your task is to complete the function cppOperator() which takes two integers A and B as input parameters and returns a vector containing the results of addition,multiplication,subtraction and division of the two numbers.

Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)

 

Constraints:
1 <= A,B <= 10000

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

C++ Operators | Set 1 (Arithmetic)

Output Window