Question: Given two integers dividend and divisor, write a programme in python that return the quotient after dividing the dividend by the divisor without using multiplication,

Given two integers dividend and divisor, write a programme in python that return the quotient after dividing the dividend by the divisor without using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part (for example, 8.345 would be truncated to 8, and -2.7335 would be truncated to -2). For an input of dividend =10 and divisor =3, the output is 3 because 10/3=3.3333 which is truncated to 3. Also, for dividend =7 and divisor =-3, the output is -2 because 7/-3=-2.333 which is truncated to -2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!