![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are multiplicative operators in C++?
The multiplicative operators are −
- Multiplication (*)
- Division (/)
- Modulus or “remainder from division” (%)
These binary operators have left-to-right associativity. The multiplicative operators take operands of arithmetic sorts. The modulus operator (%) contains a stricter requirement in this its operands should be of integral type.
The multiplication operator yields the result of multiplying the first operand by the second.
The division operator yields the result of dividing the first operand by the second.
The modulus operator yields the remainder given by the subsequent expression, wherever e1 is that the 1st operand and e2 is that the second: e1 – (e1 / e2) * e2, where both operands are of integral types.
example
#include<iostream> using namespace std; int main() { int a = 4, b = 3, c; c = a * b; // Multiplication cout << c << endl; c = a / b; // Division. Since both are of int type, result will be floored int. cout << c << endl; c = a % b; // Modulo cout << c << endl; return 0; }
Output
This will give the output −
12 1 1
Advertisements