C Program to find quotient without using the division operator


In this program, You will learn how to find quotient without using division operator in c.


2 = 10 / 5

0 = 5 / 10

Example: How to find quotient without using division operator in c.

#include<stdio.h>

int main() {

  int a, b, c = 0;

  printf("Enter two numbers:");
  scanf("%d%d", &a,&b);

  while (a >= b) {
    a = a - b;
    c++;
  }

  printf("The quotient is:%d", c);
  return 0;
}

Output:

Enter two numbers:9 3                                                                                                                                               
The quotient is:3