what is a operator in c ?
what is a operator in c ?
Operator :- Operator Are Nothing But The Special Symbols That Perform Of Operation On Variable.
Types Of Operators
- Arithmetic Operators.
- Relocation Operators.
- Logical Operators.
- Assignment Operators.
- Increment And Decrement Operators.
- Conditional Operators.
- Bitwise Operators.
- + Addition C = a + b = 5 + 12 = 17
- - Subtraction C = a - b = 5 - 12 = 7
- * Multiplication C = a * b = 5 * 12 = 60
- / Division C = a / b = 5 / 12 = 0
- % Modulus C = a % b = 5 % 12 = 5
- < Less Than.
- > Greater Than.
- < = Less Than Or Equal.
- > = Greater Than Or Equal.
- = = Equal TO.
- ! = NOT Equal.
- && And
- || Or
- ! Not
- Anly One Condition Is False = False. /* 0 && 1 = 0 */
- All Condition Are True = True. /* 1 && 1 = 1 */
A Truth Table Of AND |
int a =
15 ,
b = 10 ,
c =
5 ;
1} a
< b && a
< c
15 <
10 && 15
< 5
0 && 0 = 0
2} a
< b && a
> c
15 < 10
&& 15 > 5
0 && 1 = 0
3}
a >
b && a
< c
15 > 10
&& 15 < 5
1 && 0 = 0
4}
a >
b && a
> c
15 > 10
&& 15 > 5
1 && 1 = 1
2] || Or :-
- Anly One Condition Is True = True. /* 0 && 1 = 1 */
- All Condition Are False . /* 1 && 1 = 1 */
A Truth Table Of OR |
int a =
15 ,
b = 10 ,
c =
5 ;
1} a
< b ||
a < c
15 < 10 || 15
< 5
0 || 0 = 0
2} a
< b || a
> c
15 < 10 || 15
> 5
0 || 1 = 1
3}
a >
b ||
a < c
15 > 10
|| 15 < 5
1 || 0 = 1
4}
a >
b ||
a > c
15 > 10 || 15 >
5
1 || 1 = 1
3] !
NOT :-
True = False
False = True
A Truth Table Of NOT |
1} !
( a <
b || a
< c )
! ( 15 <
10 || 15
< 5 )
! 0 || 0 =
1
2} !
( a >
b || a
< c )
! ( 15
< 10 ||
15 < 5 )
! 1 || 0 = 0
4} Assignment Operators :- Assignment Operators Are Used To Declination Right Side Experience Value To Left Side Variable.
Ex
:
=
a = 5 ;
b = a * 5 + 10 * 3 ;
b = 5 *
5 + 10 * 3 ;
b = 25 + 30 ;
b = 55 ;
- + = Addition & Assignment a + = a = a + 7 = 10 + 7 = 17
- - = Subtraction & Assignment a - = a = a – 7 = 10 - 7 = 3
- * = Multiplication & Assignment a * = a = a * 7 = 10 * 7 = 70
- / = Division & Assignment a / = a = a / 7 = 10 / 7 = 1
- % =Modulus & Assignment a % = a = a % 7 = 10 % 7 = 3
int a = 10
, b = 3 , c = 5 ;
a +
= b *
c + 5 * 3
a
+ = 3
* 5 +
5 * 3
a + =
15 + 15
a + = 30
a = a + 30
a = 10 +
30
a = 40
5}
Comments
Post a Comment