(Arithmetic) Write a program that asks the user to enter two numbers, obtains the two numbers from the user and prints the sum, product, difference, and quotient of the two numbers.
Solution:
#include <iostream> using std::cin; using std::cout; using std::endl; int main() { int i, j; cout << "Enter two numbers: "; cin >> i >> j; cout << "sum = " << i + j << endl << "product = " << i * j << endl << "difference = " << i - j << endl << "quotient = " << i / j; return 0; }
Post A Comment:
0 comments: