Home » C Program To Find Reminder And Quotient

C Program To Find Reminder And Quotient

This program uses a division operator on two input numbers. The output is a quotient and a remainder is printed to the console.

We compiled the program using Turbo C++ 3.0 running in a DOS Box 0.74  on a Windows 7  64-bit system. You may try the program using a different standard C compiler, but make necessary changes to the source code.

Learn the following concepts before you try this example program.

Problem Definition

When the program runs, it ask for two input numbers, a and b. The number a is dividend and b is divisor for the program which uses division operator (/) to divide the numbers and return the results.

The program performs the simple division as follows,

q = a/b 
r = a % b

Where a and b are two integers values and q is quotient and r is remainder values respectively.

Flowchart – Program to find Quotient and Remainder

Flowchart - C Program to Find Quotient and Remainder
Flowchart – C Program to Find Quotient and Remainder

Program Code – Remainder and Quotient

#include <stdio.h>
#include <conio.h>
    int dnd, div, quotient, remainder;
    int i;
    //Enter Input Numbers 'a' and 'b'
    printf ("Enter the dividend:");
    scanf ("%d", &dnd);
    printf ("Enter the divisor :");
    scanf ("%d",&div);
    //Compute Quotient and Remainder
        quotient = dnd/div;
        remainder = dnd % div;
     //Print the Results
      for(i=0;i < 20;i++)
        printf ("Quotient = %d\n", quotient);
        printf ("Remainder= %d\n", remainder);
    getch ();
    return 0;

The most important code in the above program is as follows.

(adsbygoogle = window.adsbygoogle || []).push({}); </script

Please support us by disabling your adblocker or whitelist this site from your adblocker. Thanks!

turn of adblocker imag

(adsbygoogle = window.adsbygoogle || []).push({});