Operator in c

ankush9927 55 views 10 slides Apr 17, 2020
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

A Operator specifies an operation to be performed that yields a value.
The variable, constant can be joined by various operator to form an expression and operand on which an operator act some operators require to operands, while other act upon only one operand.


Slide Content

HELLO FRIENDS OPERATOR TOPIC

OPERATOR A Operator specifies an operation to be performed that yields a value. The variable, constant can be joined by various operator to form an expression and operand on which an operator act some operators require to operands, while other act upon only one operand.

OPERATORS Arithmetic Operator Assignment Operator Increment/Decrement Operator Sizeof Operator Ternary Operator Comma Operator Logical Operator Relational Operator Bitwise Operator

ARITHMETIC OPERATOR Arithmetic operator are used for numeric calculations. They are of two types- Unary arithmetic operator- Unary operators require only one operand. Example- ( ++x, --x) prefix, (x++, x–-) postfix Binary Arithmetic Operator- require two operands. Example- (a + b), (x-y), (p*q), (s/t) and (m % n)

ARITHMETIC OPERATOR #include< stdio.h > # include< conio.h > v oid main() { int a=5, b=6; printf (“%d ”,++a);//unary ,prefix printf (“%d ”,--a); // unary ,prefix printf (“% d ”,a ++);//Unary ,Postfix printf (“% d ”,a --);//Unary, Postfix printf (“%d ”,( a+b )); //Binary printf (“%d ”,(b-a)); //Binary printf (“%d ”,(a*b)); //Binary printf (“%d ”,(b/a)); //Binary printf (“%d ”,( b %a )); //Binary getch (); } 6 5 5 6 11 1 30 1 1 OUTPUT SCREEN

BINARY ARITHMETIC OPERATOR Binary arithmetic operator are three types- Integer Arithmetic operator Floating Arithmetic operator Mixed mode Arithmetic operator

Integer Arithmetic operator #include< stdio.h > #include< conio.h > void main() { int a=17, b=4; printf (“%d”,( a+b )); //Binary printf (“%d ”,(a-b)); //Binary printf (“%d”,(a*b)); //Binary printf (“%d ”,( a /b)); //Binary printf (“%d”,( b%a )); //Binary getch (); } 21 13 68 4 1 OUTPUT SCREEN

Floating Arithmetic operator #include< stdio.h > #include< conio.h > void main() { float a=12.4, b=3.1; printf (“%d”,( a+b )); //Binary printf (“%d ”,(a-b)); //Binary printf (“%d”,(a*b)); //Binary printf (“%d ”,(a/b)); // Binary getch (); } 15.5 9.3 38.44 4.0 OUTPUT SCREEN

Mixed mode Arithmetic operator #include< stdio.h > #include< conio.h > void main() { float a=12, b=2.5; printf (“%d”,( a+b )); //Binary printf (“%d ”,(a-b)); //Binary printf (“%d”,(a*b)); //Binary printf (“%d ”,( a /b)); // Binary getch (); } 14.5 9.5 30.0 4.8 OUTPUT SCREEN

THANKS
Tags