Syvum Home Page

Home > Quiz Games > C++ Programming > Print Preview

C++ Programming : Program 21-A

Program to enter two integers and print the quotient and remainder


 

#include <iostream.h>
#include <conio.h>
int main()
{
clrscr();
int x,y,quotient,remainder;
cout << "Enter 2 integers greater than 0 : ";
cin>>x>>y;
quotient=x/y;
remainder=x-(quotient*y);
cout << "Quotient of " << x << " & " << y << " = " << quotient << "\n";
cout << "Remainder" << " = " << remainder << "\n";
getch();
return 0;
}

This program takes in two integers x and y as a screen input from the user.
It then calculates their quotient and remainder and outputs them using the 'cout' command.

23 4

Quotient of 23 & 4 = 5
Remainder = 3

Index of C++ Programs
 

-
-
 
45 more pages in C++ Programming

Contact Info © 1999-2017 Syvum Technologies Inc. Privacy Policy Disclaimer and Copyright