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();
}
#include <iostream> //fixed
//#include <conio.h> removed
int main() //fixed
{
system("cls"); //clrscr(); //a windows specific alternative. unix is word clear instead of cls.
//you can also just cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
int x = 10;
int y = 2;
int sum, difference, product, quotient;
//alternative: double quotient2;
sum = x + y;
difference = x - y;
product = x * y;
quotient = x / y;
//alternative quotient2 = (double)x/y; to get a decimal quotient like 10.75
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;
//put a cin>> statement here if you require the program to have the user type something before ending.
}