BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/322-object-oriented-programming/)
-   -   Program to enter two integers and print the quotient and remainder (http://bzupages.com/f322/program-enter-two-integers-print-quotient-remainder-14570/)

bonfire 01-03-2011 03:06 PM

Program to enter two integers and print the quotient and remainder
 
1 Attachment(s)
Program to enter two integers and print the quotient and remainder


#include
#include
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.

Sample Input23 4
Sample Output
Quotient of 23 & 4 = 5
Remainder = 3


All times are GMT +5. The time now is 05:34 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.