A C++ program to perform arithmetic operation
1) Arithmetic Operator:
Arithmetic operators are symbols that perform mathematical operations on data.
Operation | Symbols | Description |
Addition | + | It adds two values |
Subtraction | - | It subtracts one value from another value |
Multiplication | * | It multiplies two values |
Division | / | It divides on value by another value |
Modulus | % | It gives the remainder of division of two integers |
Examples:
#include<iostream>
using namespace std;
main()
{
int x = 8 , y = 4;
cout<<"x + y = "<< x + y << endl;
cout<<"x - y = "<< x - y<< endl;
cout<<"x * y = "<< x * y<< endl;
cout<<"x / y = "<< x / y<< endl;
cout<<"x % y = "<< x % y << endl;
}
Output:
x + y = 12
x - y = 4
x * y = 32
x / y = 2
x % y = 0
0 Comments