Find Quotient C Program

By | September 14, 2016

C Program To Find Quotient of Dividend and Divisor

Let us learn how to find quotient of a dividend and divisor in C programming language. Here, we have demonstrated different ways of calculating the quotient of a number.

What is a Quotient?

A quotient is an integer, which is achieved after you divide one number by another number. If you divide 10 by 5, the answer 2 is the quotient.

Formula To Get Quotient

Dividend / Divisor = Quotient

Get Quotient of a Number in C Programming

Note: This program to calculate quotient of a number in C programming is compiled with GNU GCC compiler and developed using gEdit Editor in Linux Ubuntu operating system.

Must Read: C Program To Print India’s Map

Method 1: C Program To Find Quotient of Dividend and Divisor

#include<stdio.h>

int main()
{
      int quotient, divisor, dividend;
      printf("\nEnter the Dividend:\t");
      scanf("%d", &dividend);
      printf("\nEnter the Divisor:\t");
      scanf("%d", &divisor);
      quotient = dividend / divisor;
      printf("\nQuotient of the Number:\t%d\n", quotient);
      return 0;
}

Method 2: C Program To Get Quotient using Function

#include<stdio.h>

int find_quotient(int a, int b)
{
      int quotient;
      quotient = a / b;
      return quotient;
}

int main()
{
      int result, divisor, dividend;
      printf("\nEnter the Dividend:\t");
      scanf("%d", &dividend);
      printf("\nEnter the Divisor:\t");
      scanf("%d", &divisor);
      result = find_quotient(dividend, divisor);
      printf("\nQuotient of the Number:\t%d\n", result);
      return 0;
}

Method 3: C Program To Calculate Quotient without using Division Operator

#include<stdio.h>

int main()
{
      int dividend, divisor, quotient = 0;
      printf("\nEnter the Dividend:\t");
      scanf("%d", &dividend);
      printf("\nEnter the Divisor:\t");
      scanf("%d", &divisor);
      while(dividend >= divisor)
      {
            dividend = dividend - divisor;
            quotient++;
      }
      printf("\nQuotient of the Number:\t%d\n", quotient);
      return 0;
}

Must Read: C Program To Check Largest Digit of a Number

 

Output

C Program To Find Quotient without Division Operator, Functions

In case you have any doubts or compilation errors in this C program for calculating quotient of a number, let us know about it in the comment section below.

Let's Discuss