Arithmetic operators in C++ are operators that perform basic mathematical operations such as addition, subtraction, multiplication, and division on numerical data types.
C++ provides the following arithmetic operators:
Arithmetic operators can be used with various data types in C++, including integers, floating-point numbers, and characters. These operators are used extensively in mathematical calculations in C++ programs.
The examples provided in my previous response demonstrate the usage of these arithmetic operators with integer data types in C++.
#include<iostream> using namespace std; int main() { int x,y; int sum; cout<<"Enter a number: "; cin>>x; cout<<"Enter another number: "; cin>>y; sum=x+y; cout<<"Sum is: "<<sum; return 0; }To download raw file Click Here
Enter a number: 5 Enter another number: 4 Sum is: 9
#include<iostream> using namespace std; int main() { int x,y; int diff; cout<<"Enter a number: "; cin>>x; cout<<"Enter another number: "; cin>>y; diff=x-y; cout<<"Difference is: "<<diff; return 0; }To download raw file Click Here
Enter a number: 56 Enter another number: 23 Difference is: 33
#include<iostream> using namespace std; int main() { int x,y; int product; cout<<"Enter a number: "; cin>>x; cout<<"Enter another number: "; cin>>y; product=x*y; cout<<"Product is: "<<product; return 0; }To download raw file Click Here
Enter a number: 78 Enter another number: 34 Product is: 2652
#include<iostream> using namespace std; int main() { int x,y; int div; cout<<"Enter a number: "; cin>>x; cout<<"Enter another number: "; cin>>y; div=x/y; cout<<"Division is: "<<div; return 0; }To download raw file Click Here
Enter a number: 67 Enter another number: 3 Division is: 22
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions