C Program to find quotient and remainder


In this program, You will learn how to find quotient and remainder in c.


2 = 10 / 5

0 = 10 % 5

Example: How to find quotient and remainder in c.

#include<stdio.h>

int main() {

  int a, b, q, r;

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

  q = a / b;
  r = a % b;

  printf("Quotient is:%d", q);
  printf("\nRemainder is:%d", r);

  return 0;
}

Output:

Enter two numbers:9 2                                                                                                                                               
Quotient is:4                                                                                                                                                       
Remainder is:1