Math Operators
C
// Addition
a + b;
// Subtraction
a – b;
// Multiplication
a * b;
// Division & Floor Division
a / b; // If both are Integers, result will be a Integer
a / b * 1.0; // If you want an float result, you can multiply one of them to 1.0
(float) a / b; // Or, you can also use a simple type cast
// Exponent
// Not Available
// Use math.h library
// Modulus
a % b; // It returns the "remainder" after the division (modulo division)
C++ (Cpp)
// Addition
a + b;
// Subtraction
a – b;
// Multiplication
a * b;
// Division & Floor Division
a / b; // If both are Integers, result will be a Integer
a / b * 1.0; // If you want an float result, you can multiply one of them to 1.0
static_cast<float>(a) / b; // Or, you can also use a C++ static cast
// Exponent
// Not Available
// Modulus
a % b; // It returns the "remainder" after the division (modulo division)
C# (Csharp)
// Addition
a + b;
// Subtraction
a – b;
// Multiplication
a * b;
// Division & Floor Division
a / b; // If both are Integers, result will be a Integer
a / b * 1.0; // If you want an float result, you can multiply one of them to 1.0
(float) a / b; // Or, you can also use a simple type cast
// Exponent
// Not Available
// Modulus
a % b; // It returns the "remainder" after the division (modulo division)
Java
// Addition
a + b;
// Subtraction
a – b;
// Multiplication
a * b;
// Division & Floor Division
a / b; // If both are Integers, result will be a Integer
a / b * 1.0; // If you want an float result, you can multiply one of them to 1.0
(float) a / b; // Or, you can also use a simple type cast
// Exponent
// Not Available
// Modulus
a % b; // It returns the "remainder" after the division (modulo division)
Rust
// TODO
Go
// TODO
Javascript
// TODO
Typescript
// TODO
Python
# Addition
a + b
# Subtraction
a – b
# Multiplication
a * b
# Division
a / b # Result will be a Float
#Floor Division
a // b # Result will be a Integer
# Exponent
a ** b
# Modulus
a % b # It returns the "remainder" after the division (modulo division)