Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Arithmetic Operators in C++

What are Arithmetic Operators?

Arithmetic operators are used to perform mathematical calculations like addition, subtraction, and multiplication. They are the most basic building blocks of programming logic.

OperatorOperationDescription
+AdditionAdds two values together
-SubtractionSubtracts the right value from the left value
*MultiplicationMultiplies two values
/DivisionDivides the left value by the right value
%ModulusReturns the remainder after division

Note: While the basic behavior is the same across languages, how they handle things like "Integer Division" (e.g., 5 / 2) can vary.

C++ Specific Behavior

Like C and Java, C++ performs integer division when both operands are integers.

OperatorOperationDescription
++IncrementIncreases the value by 1
--DecrementDecreases the value by 1

Code Example

#include <iostream>
using namespace std;

int main() {
int a = 10;
int b = 3;

cout << (a + b) << endl; // 13
cout << (a / b) << endl; // 3 (Integer Division)

a++;
cout << a << endl; // 11

return 0;
}

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir