Lecture2 Operator
Lecture2 Operator
Definition :-
Ex:- z=x+y;
Example :
z=x+y; z = -10 ;
z = +10; z=x–y;
-:TYPE OF OPERATORS:
1. Arithmetic’s operator
-, +,*, /,%
(Unary) (Binary)
% operator It always return remainder.
Ex:-
z = 17%5 ; z = 15 % 3 ;
z = 90%7; z = 20 % 4 ;
2:- Relational operator:-
> , <, >= , <=, == , !=
Note:-
Boolean value
True False
T F
1 0
Non zero zero
( X > 10 ) ( x == 10 )
( X < 10 ) ( x == 5 )
( X >= 10 ) ( x != 10 )
( X <= 10 ) ( x != 5 )
Special cases :
Int x = 25 ;
( X => 10 )
( X > =10 )
3:- Logical operator
&& Logical AND
|| Logical OR
! Logical NOT
Defination:- Logical operator are applied between 2 relational
expression and return Boolean value.
5: - Assignment operator
= (Bitwise Assignment operator)
+ = , -=, *=, /= (Shorthand assignment operator)
int X=5;
X = 10 ;
X += 4 ;
X -= 12 ;
X *= 7 ;
X /= 2 ;
Example :
6 :- Bitwise operator
Start
Load c
Edit program
compile
Run
O/P
Exit
-: types of error:-
1:- Compile time error/ syntax error
< stdio.h > Standard Input Output Hearder File : - It contain all
functions related to input /output operations .
Note : In any computer language the name of function is
always followed by open and close Parenthesis ‘( )’ .
Printf( ):-It is a formatted function of < stdio.h > header file which
is used to print some message or valves on moniter..