Screenshot:
![]() |
C/C++ Program To Divide Two Numbers, Without Using Divide ('/') Operator, By Successive Subtraction Method |
#include <stdio.h>
#include <stdlib.h>
void main()
{
int m,n,rem,temp=0;
printf("\nEnter number to be divided : ");
scanf("%d",&m); //Entering the dividend
printf("\nEnter number from which to be divided : ");
scanf("%d",&n); //Entering the divisor
while(m>=n)
{
m = m-n; //For Remainder
temp += 1; //For Quotient
printf("\n%d",m); //To check the status of 'm', useful for diagnostic, safe to ignore
}
printf("\n\nQuotient is : %d",temp);
printf("\nRemainder is : %d",m);
system("pause");
}
![]() |
C/C++ Program To Divide Two Numbers, Without Using Divide ('/') Operator, By Successive Subtraction Method |