Programs

C++ Program to Find Quotient and Remainder

Certainly! Here’s a simple C++ program to compute the quotient and remainder of two numbers using the Turbo C++ compiler:

#include <iostream.h>
#include <conio.h>

void main() {
    clrscr(); // Clear screen function for Turbo C++

    int dividend, divisor, quotient, remainder;

    cout << "Enter dividend: ";
    cin >> dividend;

    cout << "Enter divisor: ";
    cin >> divisor;

    // Compute quotient and remainder
    quotient = dividend / divisor;
    remainder = dividend % divisor;

    cout << "Quotient: " << quotient << endl;
    cout << "Remainder: " << remainder;

    getch(); // Wait for a key press in Turbo C++
}

To use this program in Turbo C++:

  1. Open Turbo C++.
  2. Create a new source file or open an existing one.
  3. Copy and paste the above code.
  4. Compile the program (usually by pressing Alt + F9).
  5. Run the compiled program (usually by pressing Ctrl + F9).
  6. Enter the dividend and divisor values to get the quotient and remainder.