C++ Programming

Arithmetic Operations

C plus plus code for arithmetic operations

10/26/2019
0 views
Arithmetic-operations.cppCPP
#include<iostream>

/* tells the compiler to use the std namespace */
using namespace std;

int main() {
	int a, b;
	cout << "Enter a value:\n";

	/* read number from console and store it in "a" */
	cin >> a;
	cout << "Enter another value:\n";

	/* read number from console and store it in "b" */
	cin >> b;

	/* print text and value of calculation on screen */
	cout << "Sum: " << a + b << "\n";
	cout << "Subtract: " << a - b << "\n";
	cout << "Multiplication: " << a * b << "\n";
	cout << "Division: " << a / b << "\n";
	cout << "Modulus: " << a % b << "\n";
	return 0;
}


/* Output */
/* Enter a value:
8

Enter another value:
2

Sum: 10
Subtract: 6
Multiplication: 16
Division: 4
Modulus: 0 */
cppc plus plusArithmetic operations

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com