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/index.php)
-   Object Oriented Programming (http://bzupages.com/forumdisplay.php?f=300)
-   -   Program to find the sum, difference, product and quotient of two integers (http://bzupages.com/showthread.php?t=14540)

bonfire 28-02-2011 10:41 PM

Program to find the sum, difference, product and quotient of two integers
 
1 Attachment(s)
Program to find the sum, difference, product and quotient of two integers

#include
#include

void main()
{
clrscr();
int x = 10;
int y = 2;
int sum, difference, product, quotient;
sum = x + y;
difference = x - y;
product = x * y;
quotient = x / y;
cout << "The sum of " << x << " & " << y << " is " << sum << "." << endl;
cout << "The difference of " << x << " & " << "y << is " << difference << "." << endl;
cout << "The product of " << x << " & " << y << " is " << product << "." << endl;
cout << "The quotient of " << x << " & " << y << " is " << quotient << "." << endl;
getch();
}
This program has pre-defined values for two integers x and y.
The sum, difference, product and quotient of these two values are calculated and then outputted using the 'cout' command.

Sample Output.
Click here for SAMPLE OUTPUT The sum of 10 & 2 is 12.
The difference of 10 & 2 is 8.
The product of 10 & 2 is 20.
The quotient of 10 & 2 is 5.




All times are GMT +5. The time now is 10:16 AM.

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