The "div" divides 2 integers and return both remainder and quotient as a div_t type which is a structure.
div_t div(int x,int y);
The "div" function accepts 2 parameters
#include<stdio.h> #include<stdlib.h> #include<conio.h> int main() { div_t ans; int x,y; clrscr(); printf("\nEnter the value of x and y (x/y) : "); scanf("%d%d",&x,&y); ans = div(x,y); printf("Remainder is : %d\nQuotient is : %d\n",ans.rem,ans.quot); getch(); return 0; }