Given two numbers, divide one from other without using ‘/’ operator.
Input : num1 = 13, num2 = 2 Output : 6 Input : num1 = 14, num2 = -2 Output : -7 Input : num1 = -11, num2 = 3 Output : -3 Input : num1 = 10, num2 = 10 Output : 1 Input : num1 = -6, num2 = -2 Output : 3 Input : num1 = 0, num2 = 5 Output : 0
In order to perform division operation without using ‘/’ operator we followed the approach, in which we count the number of successful or complete number of substraction of num2 from num1. Where num1 is the number to be divided and num2 is the number from which we have to divide num1.
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.
- Divide two integers without using multiplication, division and mod operator | Set2
- Modular Division
- DFA based division
- Trick for modular division ( (x1 * x2 .... xn) / b ) mod (m)
- Division Operators in Python
- Sum of division of the possible pairs for the given Array
- Check if it is possible to perform the given Grid Division
- Maximum value of division of two numbers in an Array
- Find the number after successive division
- Find two numbers with difference and division both same as N
- Write you own Power without using multiplication(*) and division(/) operators
- Maximize the division result of Array using given operations
- Trial division Algorithm for Prime Factorization
- First number to leave an odd remainder after repetitive division by 2
- Number of digits before the decimal point in the division of two numbers
- Program to compute division upto n decimal places
- Check if N leaves only distinct remainders on division by all values up to K
- Minimum steps to convert X to Y by repeated division and multiplication
- Implementation of Restoring Division Algorithm for unsigned integer
- Find Quotient and Remainder of two integer without using division operators
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.