Given two numbers, perform multiplication, subtraction and division operations on them, using ‘+’ arithmetic operator only.
Operations can be performed as follows:
Subtraction :- a - b = a + (-1)*b. Multiplication :- a * b = a + a + a ... b times. Division :- a / b = continuously subtract b from a and count how many times we can do that.
The above steps look simple, but it is slightly challenging as we can’t even use – to subtract.
Subtraction is 6 Product is -54 Division is 4
Related Articles :
- Add two numbers without using arithmetic operators
- Subtract two numbers without using arithmetic operators
- Multiply two integers without using multiplication, division and bitwise operators, and no loops
This article is contributed by Sakshi Tiwari. If you like GeeksforGeeks (We know you do!) and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find Harmonic mean using Arithmetic mean and Geometric mean
- Print pattern using only one loop | Set 1 (Using setw)
- Find the remainder when N is divided by 4 using Bitwise AND operator
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
- Program to implement ASCII lookup table
- Division without using '/' operator
- Addition of two number using '-' operator
- C program to check if a given year is leap year using Conditional operator
- Ratio of mth and nth term in an Arithmetic Progression (AP)
- Smallest number greater than or equal to N using only digits 1 to K
- Program for sum of arithmetic series
- Program for N-th term of Arithmetic Progression series
- Program to print Arithmetic Progression series
- Ternary Operator in Python
- Operator Functions in Python | Set 1
- Operator Overloading in C++
- Basics of Computer and its Operations
- Number of handshakes such that a person shakes hands only once
- Longest Subsequence of a String containing only vowels
- Minimum swaps to make two strings equal by swapping only with third string
Improved By : Mithun Kumar