SlideShare a Scribd company logo
1 of 33
Download to read offline
Paper: Introduction Programming Language using C
Paper ID: 20105
Paper Code: BCA 105
DR. VARUN TIWARI
(ASSOCIATE PROFESSOR)
(DEPARTMENT OF COMPUTER SCIENCE)
BOSCO TECHNICAL TRAINING SOCIETY,
DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
C Operator
Objectives
In this unit you will learn:
1. To understand about Operator.
2. To learn about how many types of Operator.
3. To use of Bitwise Operator in C.
4. To use of Relational Operator in C.
5. To learn about Logical Operator in C.
6. To learn about Assignment Operator in C.
7. To learn about Ternary Operator in C.
8. To learn about Arithmetic Operator in C.
Operator: An operator is a symbol that is used to perform mathematical and logical
operation etc. in C language. Its tells to compiler to perform a specific calculation.
1. Arithmetic Operator
2. Relational Operator
3. Logical Operator
4. Bitwise Operator
5. Assignment Operator
6. Ternary Operator or Conditional Operator
7. Increment / Decrement Operator
8. Unary Operator and Binary Operator
1. Arithmetic Operator: It is perform arithmetic operation in C.
Example -: In this program, user input two values from keyboard and perform arithmetic
operations such as addition, subtraction, multiplication, division, modulus and output is
displayed for each operation.
Operator Description
+ For Addition
- For Subtraction
* For Multiplication
/ For Division
% For Percentage (Modulus)
2. Relational Operator: it is used to perform relation between two variables or it compare
the values of two variables in C.
Operator Description
> a>b (Compare a is greater than b) its return true/false
< a<b (Compare a is less than b) its return true/false
>= a>=b (Compare a is greater than equal to b) return true/false
<= a<=b (Compare a is less than equal to b) return true/false
== a==b (compare a is equal to b)
!= a!=b (compare a is not equal to b)
3. Logical Operator: it is used to perform logical operation on the given expression.
Operator Description
&& Logical AND
|| Logical OR
! Logical NOT
4. Bitwise Operator: it is used to perform decimal value to covert binary value which are the
form of bits and bitwise operator works in these bits. Its perform bits operation.
Truth table of Bitwise Operator:
a b a&b (AND) a|b (OR) a^b (XOR)
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
Operator Description
& Bitwise AND
| Bitwise OR
~ Bitwise NOT or Complement
^ Bitwise XOR
<< Bitwise Left Shift
>> Bitwise Right Shift
5. Assignment Operator: it is used to assign a value of variable.
Operator Description
= a=10; (assign a value of variable)
C=a+b; (passing multiple variable value to a new variable)
6. Ternary or Conditional Operator: it return one value. If the condition is true return first
otherwise it return second value. This operator is also called ternary operator.
Syn. (condition/expression? True : False)
Example: p=(i<10?11:12);
7. Increment / Decrement Operator: Increment operator increase a value of variable by
one and decrement operator is used to decrease a value of variable by one. This is two
types first is prefix and second is postfix.
Syn. ++variable name; (prefix) , variablename++ (postfix) (increment)
-- variable name (prefix) , variablename - - (postfix) (decrement)
example: ++p; (value of p increment before assigning it to the variable p) , p++ (value of
p increment after assigning it to the variable p) ;
-- p ; (value of p decrement before assigning it to the variable p) , p-- (value
of p decrement after assigning it to the variable p) ;
8. Unary Operator and Binary Operator: Unary operators that operates or works with single
operand are called unary operator. (ex: ++,--,~,size of)
Binary operator that operates or works between the two variable are called binary
operator. (+,-,/,%,*)
Hierarchy of Operations
Priority Operators Description
1st *, / , % Multiplication, division ,
modular division
2nd + , - Addition , Subtraction
3rd = Assignment
Example 1, 2, 3
 Ex- 1 - : // Perform Operation in Int Form
C = 1 * 5 / 4 + 7 / 7 + 9 – 2 + 5 / 8
C = 5/4 + 7/7 + 9 – 2 + 5/8 // operation *
C = 1 + 7/7 + 9 – 2 + 5 / 8 // Operation /
C = 1 + 1 + 9 – 2 + 5/8 // operation /
C = 1 + 1 + 9 – 2 + 0 // Operation /
C = 2 + 9 – 2 + 0 // Operation +
C = 11 – 2 + 0 // Operation +
C = 9 + 0 // Operation -
C = 9 // operation +
Example 1, 2, 3
 Ex- 2 - :
// Perform Operation in Float Form
C = 1 * 5 / 4 + 7 / 7 + 9 – 2 + 5 / 8
C = 5/4 + 7/7 + 9 – 2 + 5/8 // operation *
C = 1.25 + 7/7 + 9 – 2 + 5 / 8 // Operation /
C = 1.25 + 1.0 + 9 – 2 + 5/8 // operation /
C = 1.25 + 1.0 + 9 – 2 + 0.625 // Operation /
C = 2.25 + 9 – 2 + 0.625 // Operation +
C = 11.25 – 2 + 0.625 // Operation +
C = 9.25 + 0.625 // Operation -
C = 9.875 // operation +
Example 1, 2, 3
 Ex- 3 - :
// use modulus division
P = 4 / 6 + 12 % 4 + 8 – 9 + 2 * 7 // operation *
P = 4/6 + 12 % 4 + 8 – 9 + 14 // Operation /
P = 4 / 6 + 12%4 + 8 – 9 + 14 // Operation /
P= 0 + 12%4 + 8 -9 + 14 //Operation %
P = 0 + 0 + 8 – 9 + 14 // Operation +
P = 8 – 9 + 14 // Operation +
P = 8 – 9 + 14 // Operation -
P= -1 + 14 // Operation +
P = 13
Example 1, 2, 3
 Solve this Questions:
1. A = 12/5 + 7 – 9 %3 - 3 + 5 * 10 // int form
2. B = 4+ 6 + 9 /3 + 4*9 + 3*2 / 1 //float and int both
3. C = 5/2 + 7 * 10 – 3 % 2 + 11 + 13 /2 – 9 + 12 * 5 // int form
4. D = 7 * 8 + 12 + 6 / 2 – 8 + 10 % 2 – 5 + 9 * 1 + 2 // int form
Operator Precedence
Operator Name Description
() Parentheses (grouping)
[] Brackets (array subscript)
. Member selection via object name
-> Member selection via pointer
++ -- Unary preincrement/predecrement
+ - Unary plus/minus
! ~ Unary logical negation/bitwise complement
(type) Unary cast (change type)
* Dereference
& Address
sizeof Determine size in bytes
* / % Multiplication/division/modulus
+ - Addition/subtraction
<< >> Bitwise shift left, Bitwise shift right
< <= Relational less than/less than or equal to
> >= Relational greater than/greater than or equal to
== != Relational is equal to/is not equal to
& Bitwise AND
^ Bitwise exclusive OR
| Bitwise inclusive OR
&& Logical AND
|| Logical OR
?: Ternary conditional
= Assignment
+= -= Addition/subtraction assignment
*= /= Multiplication/division assignment
%= &= Modulus/bitwise AND assignment
^= |= Bitwise exclusive/inclusive OR assignment
<<= >>= Bitwise shift left/right assignment
, Comma (separate expressions)
THANK YOU

More Related Content

What's hot

Few Operator used in c++
Few Operator used in c++Few Operator used in c++
Few Operator used in c++sunny khan
Β 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
Β 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++Pranav Ghildiyal
Β 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++Praveen M Jigajinni
Β 
Operators in python
Operators in pythonOperators in python
Operators in pythonPrabhakaran V M
Β 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++Online
Β 
Expressions in c++
 Expressions in c++ Expressions in c++
Expressions in c++zeeshan turi
Β 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++Shobi P P
Β 
Variables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailVariables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailgourav kottawar
Β 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssionseShikshak
Β 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c languagetanmaymodi4
Β 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++Neeru Mittal
Β 
C OPERATOR
C OPERATORC OPERATOR
C OPERATORrricky98
Β 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programmingprogramming9
Β 

What's hot (19)

Python : Operators
Python : OperatorsPython : Operators
Python : Operators
Β 
Few Operator used in c++
Few Operator used in c++Few Operator used in c++
Few Operator used in c++
Β 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Β 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++
Β 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
Β 
Operators and Expressions in C++
Operators and Expressions in C++Operators and Expressions in C++
Operators and Expressions in C++
Β 
Operators in python
Operators in pythonOperators in python
Operators in python
Β 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
Β 
Operation and expression in c++
Operation and expression in c++Operation and expression in c++
Operation and expression in c++
Β 
Lecture 3
Lecture 3Lecture 3
Lecture 3
Β 
Expressions in c++
 Expressions in c++ Expressions in c++
Expressions in c++
Β 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
Β 
Variables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailVariables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detail
Β 
Working with IDE
Working with IDEWorking with IDE
Working with IDE
Β 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
Β 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
Β 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++
Β 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
Β 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
Β 

Similar to C Operators

C programming session 02
C programming session 02C programming session 02
C programming session 02Dushmanta Nath
Β 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3rohassanie
Β 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statementsCtOlaf
Β 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariTHE NORTHCAP UNIVERSITY
Β 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c languageTanmay Modi
Β 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of PrecedenceMuhammad Hammad Waseem
Β 
Python as a calculator
Python as a calculatorPython as a calculator
Python as a calculatorHemantChaurasia8
Β 
C operators
C operatorsC operators
C operatorsGPERI
Β 
Operators
OperatorsOperators
OperatorsKamran
Β 
C++.pptx
C++.pptxC++.pptx
C++.pptxSabi995708
Β 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptxJAYAPRIYAR7
Β 
3.OPERATORS_MB.ppt .
3.OPERATORS_MB.ppt                      .3.OPERATORS_MB.ppt                      .
3.OPERATORS_MB.ppt .happycocoman
Β 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzationKaushal Patel
Β 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3sotlsoc
Β 
05 operators
05   operators05   operators
05 operatorsdhrubo kayal
Β 

Similar to C Operators (20)

C programming session 02
C programming session 02C programming session 02
C programming session 02
Β 
FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3FP 201 Unit 2 - Part 3
FP 201 Unit 2 - Part 3
Β 
Coper in C
Coper in CCoper in C
Coper in C
Β 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statements
Β 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
Β 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
Β 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
Β 
Python as a calculator
Python as a calculatorPython as a calculator
Python as a calculator
Β 
ICP - Lecture 5
ICP - Lecture 5ICP - Lecture 5
ICP - Lecture 5
Β 
C operators
C operatorsC operators
C operators
Β 
Theory3
Theory3Theory3
Theory3
Β 
Operators
OperatorsOperators
Operators
Β 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
Β 
C++.pptx
C++.pptxC++.pptx
C++.pptx
Β 
What are operators?
What are operators? What are operators?
What are operators?
Β 
Topic 2_revised.pptx
Topic 2_revised.pptxTopic 2_revised.pptx
Topic 2_revised.pptx
Β 
3.OPERATORS_MB.ppt .
3.OPERATORS_MB.ppt                      .3.OPERATORS_MB.ppt                      .
3.OPERATORS_MB.ppt .
Β 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
Β 
Chapter 3.3
Chapter 3.3Chapter 3.3
Chapter 3.3
Β 
05 operators
05   operators05   operators
05 operators
Β 

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi) (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
Β 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
Β 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
Β 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
Β 
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Bit field enum and command line arguments
Β 
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory Allocation
Β 
Array in C
Array in CArray in C
Array in C
Β 
C storage class
C storage classC storage class
C storage class
Β 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Β 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
Β 
C programming Basics
C programming BasicsC programming Basics
C programming Basics
Β 
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Software Development Skills and SDLC
Β 
Mobile commerce
Mobile commerceMobile commerce
Mobile commerce
Β 
E commerce application
E commerce applicationE commerce application
E commerce application
Β 
Data normalization
Data normalizationData normalization
Data normalization
Β 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
Β 
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
Security issue in e commerce
Β 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
Β 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Β 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
Β 

Recently uploaded

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
Β 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
Β 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
Β 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ9953056974 Low Rate Call Girls In Saket, Delhi NCR
Β 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
Β 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
Β 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
Β 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
Β 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
Β 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
Β 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
Β 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
Β 

Recently uploaded (20)

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
Β 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
Β 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
Β 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
Β 
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈcall girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
call girls in Kamla Market (DELHI) πŸ” >ΰΌ’9953330565πŸ” genuine Escort Service πŸ”βœ”οΈβœ”οΈ
Β 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
Β 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
Β 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
Β 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
Β 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
Β 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
Β 
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Β 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Β 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
Β 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
Β 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Β 

C Operators

  • 1. Paper: Introduction Programming Language using C Paper ID: 20105 Paper Code: BCA 105 DR. VARUN TIWARI (ASSOCIATE PROFESSOR) (DEPARTMENT OF COMPUTER SCIENCE) BOSCO TECHNICAL TRAINING SOCIETY, DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
  • 3. Objectives In this unit you will learn: 1. To understand about Operator. 2. To learn about how many types of Operator. 3. To use of Bitwise Operator in C. 4. To use of Relational Operator in C. 5. To learn about Logical Operator in C. 6. To learn about Assignment Operator in C. 7. To learn about Ternary Operator in C. 8. To learn about Arithmetic Operator in C.
  • 4. Operator: An operator is a symbol that is used to perform mathematical and logical operation etc. in C language. Its tells to compiler to perform a specific calculation. 1. Arithmetic Operator 2. Relational Operator 3. Logical Operator 4. Bitwise Operator 5. Assignment Operator 6. Ternary Operator or Conditional Operator 7. Increment / Decrement Operator 8. Unary Operator and Binary Operator
  • 5. 1. Arithmetic Operator: It is perform arithmetic operation in C. Example -: In this program, user input two values from keyboard and perform arithmetic operations such as addition, subtraction, multiplication, division, modulus and output is displayed for each operation. Operator Description + For Addition - For Subtraction * For Multiplication / For Division % For Percentage (Modulus)
  • 6.
  • 7.
  • 8. 2. Relational Operator: it is used to perform relation between two variables or it compare the values of two variables in C. Operator Description > a>b (Compare a is greater than b) its return true/false < a<b (Compare a is less than b) its return true/false >= a>=b (Compare a is greater than equal to b) return true/false <= a<=b (Compare a is less than equal to b) return true/false == a==b (compare a is equal to b) != a!=b (compare a is not equal to b)
  • 9.
  • 10.
  • 11. 3. Logical Operator: it is used to perform logical operation on the given expression. Operator Description && Logical AND || Logical OR ! Logical NOT
  • 12.
  • 13. 4. Bitwise Operator: it is used to perform decimal value to covert binary value which are the form of bits and bitwise operator works in these bits. Its perform bits operation. Truth table of Bitwise Operator: a b a&b (AND) a|b (OR) a^b (XOR) 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 Operator Description & Bitwise AND | Bitwise OR ~ Bitwise NOT or Complement ^ Bitwise XOR << Bitwise Left Shift >> Bitwise Right Shift
  • 14.
  • 15.
  • 16. 5. Assignment Operator: it is used to assign a value of variable. Operator Description = a=10; (assign a value of variable) C=a+b; (passing multiple variable value to a new variable)
  • 17. 6. Ternary or Conditional Operator: it return one value. If the condition is true return first otherwise it return second value. This operator is also called ternary operator. Syn. (condition/expression? True : False) Example: p=(i<10?11:12);
  • 18.
  • 19. 7. Increment / Decrement Operator: Increment operator increase a value of variable by one and decrement operator is used to decrease a value of variable by one. This is two types first is prefix and second is postfix. Syn. ++variable name; (prefix) , variablename++ (postfix) (increment) -- variable name (prefix) , variablename - - (postfix) (decrement) example: ++p; (value of p increment before assigning it to the variable p) , p++ (value of p increment after assigning it to the variable p) ; -- p ; (value of p decrement before assigning it to the variable p) , p-- (value of p decrement after assigning it to the variable p) ;
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. 8. Unary Operator and Binary Operator: Unary operators that operates or works with single operand are called unary operator. (ex: ++,--,~,size of) Binary operator that operates or works between the two variable are called binary operator. (+,-,/,%,*)
  • 27. Hierarchy of Operations Priority Operators Description 1st *, / , % Multiplication, division , modular division 2nd + , - Addition , Subtraction 3rd = Assignment
  • 28. Example 1, 2, 3  Ex- 1 - : // Perform Operation in Int Form C = 1 * 5 / 4 + 7 / 7 + 9 – 2 + 5 / 8 C = 5/4 + 7/7 + 9 – 2 + 5/8 // operation * C = 1 + 7/7 + 9 – 2 + 5 / 8 // Operation / C = 1 + 1 + 9 – 2 + 5/8 // operation / C = 1 + 1 + 9 – 2 + 0 // Operation / C = 2 + 9 – 2 + 0 // Operation + C = 11 – 2 + 0 // Operation + C = 9 + 0 // Operation - C = 9 // operation +
  • 29. Example 1, 2, 3  Ex- 2 - : // Perform Operation in Float Form C = 1 * 5 / 4 + 7 / 7 + 9 – 2 + 5 / 8 C = 5/4 + 7/7 + 9 – 2 + 5/8 // operation * C = 1.25 + 7/7 + 9 – 2 + 5 / 8 // Operation / C = 1.25 + 1.0 + 9 – 2 + 5/8 // operation / C = 1.25 + 1.0 + 9 – 2 + 0.625 // Operation / C = 2.25 + 9 – 2 + 0.625 // Operation + C = 11.25 – 2 + 0.625 // Operation + C = 9.25 + 0.625 // Operation - C = 9.875 // operation +
  • 30. Example 1, 2, 3  Ex- 3 - : // use modulus division P = 4 / 6 + 12 % 4 + 8 – 9 + 2 * 7 // operation * P = 4/6 + 12 % 4 + 8 – 9 + 14 // Operation / P = 4 / 6 + 12%4 + 8 – 9 + 14 // Operation / P= 0 + 12%4 + 8 -9 + 14 //Operation % P = 0 + 0 + 8 – 9 + 14 // Operation + P = 8 – 9 + 14 // Operation + P = 8 – 9 + 14 // Operation - P= -1 + 14 // Operation + P = 13
  • 31. Example 1, 2, 3  Solve this Questions: 1. A = 12/5 + 7 – 9 %3 - 3 + 5 * 10 // int form 2. B = 4+ 6 + 9 /3 + 4*9 + 3*2 / 1 //float and int both 3. C = 5/2 + 7 * 10 – 3 % 2 + 11 + 13 /2 – 9 + 12 * 5 // int form 4. D = 7 * 8 + 12 + 6 / 2 – 8 + 10 % 2 – 5 + 9 * 1 + 2 // int form
  • 32. Operator Precedence Operator Name Description () Parentheses (grouping) [] Brackets (array subscript) . Member selection via object name -> Member selection via pointer ++ -- Unary preincrement/predecrement + - Unary plus/minus ! ~ Unary logical negation/bitwise complement (type) Unary cast (change type) * Dereference & Address sizeof Determine size in bytes * / % Multiplication/division/modulus + - Addition/subtraction << >> Bitwise shift left, Bitwise shift right < <= Relational less than/less than or equal to > >= Relational greater than/greater than or equal to == != Relational is equal to/is not equal to & Bitwise AND ^ Bitwise exclusive OR | Bitwise inclusive OR && Logical AND || Logical OR ?: Ternary conditional = Assignment += -= Addition/subtraction assignment *= /= Multiplication/division assignment %= &= Modulus/bitwise AND assignment ^= |= Bitwise exclusive/inclusive OR assignment <<= >>= Bitwise shift left/right assignment , Comma (separate expressions)