-: Operators in Programming Languages :-
Operators -
In the programing Languages, operators are those symbols which are used between operands to perform any operation.
For Example :- 4 + 7 = 12
where,
(4) and (7) are Operands
(+) and (=) sign are Operators
Types of Operators in C++ Language :-
- Arithmetic Operators (+, -, *, /, %)
- Relational Operators (<, >, ==, !=, <=, >=)
- Logical Operators (&&, ||, !)
- Bitwise Operators (&, |, ~, ^, >>, <<)
- Increment Decrement Operators (++, - -)
- Assignment Operators (=, +=, - =, *=, /=)
- Conditional or Ternary Operators (?, :)
- Special or Other Operator (sizeof() )
Arithmetic Operators -
These Operators are used between operands to perform arithmetic mathematical operations.
____________________________________________________________
A program to understand Arithmetic Operators :
#include<iostream>
using namespace std ;
int main() {
int a = 10, b = 5;
int c = a + b;
cout<<"Addition Of Two Numbers = " <<c <<endl;
int d = a - b ;
cout<<"Difference of Two Numbers = " <<d <<endl;
int e = a * b ;
cout<<"Product of Two Numbers = " <<e <<endl;
int f = a/b ;
cout<<"Division of Two Numbers = " <<f <<endl;
int g = a % b ;
cout<<"Module of Two Numbers = " <<g ;
return 0;
}
OUTPUT :-
Addition Of Two Numbers = 15
Difference of Two Numbers = 5
Product of Two Numbers = 50
Division of Two Numbers = 2
Module of Two Numbers = 0
where , Module
(%) gives us remainder as a results.
____________________________________________________________
No comments:
Post a Comment