div function(Integer Division) in C Language – example and detail

In the C Programming Language, the div characteristic divides numerator with the aid of denominator. Based on that division calculation, the div characteristic returns a shape containing two contributors – quotient and remainder.

Syntax

The syntax for the div function in the C Language is:

div_t div(int numerator, int denominator);

Parameters or Arguments

numerator The price that is divided by means of denominator in the division calculation. denominator The value divided into numerator in the division calculation. So if numerator is 10 and denominator is 2, then 10 would be divided with the aid of two

Returns

The div characteristic returns a shape with the ensuing quotient and remainder based on the division calculation.

Required Header

In the C Language, the required header for the div characteristic is:

#include <stdlib.h>

Applies To

In the C Language, the div function can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the div function:

ldiv function <stdlib.h>