0% found this document useful (0 votes)
23 views

1T4-Programming in C: Online Learning Management System

This document provides an overview of operators in the C programming language. It discusses arithmetic, relational, logical, bitwise, assignment, ternary, and sizeof operators. Examples are given to demonstrate how each operator works, such as how arithmetic operators perform mathematical operations on variables and how relational operators compare variable values. Truth tables are included to show the logic of the logical operators. The document also explains how increment/decrement operators update variable values and different assignment operators.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

1T4-Programming in C: Online Learning Management System

This document provides an overview of operators in the C programming language. It discusses arithmetic, relational, logical, bitwise, assignment, ternary, and sizeof operators. Examples are given to demonstrate how each operator works, such as how arithmetic operators perform mathematical operations on variables and how relational operators compare variable values. Truth tables are included to show the logic of the logical operators. The document also explains how increment/decrement operators update variable values and different assignment operators.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Online Learning Management System

BACHELOR OF COMMERCE IN COMPUTER APPLICATION

1T4- Programming in c

Faculty - Prof. Kothiram N. Girsawale


(MCM,MBA)
CO 1
Given the problem student can identify and apply the required number of variable ,data type
control statements and will be able to develop a program..

Learning Objectives
• Student will be able to understand operators in c
• Student will be able to use operators in program
• Student will be able to use different types of operators in programming construct
Operators
Operator is a special symbol that tells the
compiler to perform specific mathematical or
logical Operation.
Types of Operators
• Arithmetic Operators
• Relational Operators
• Logical Operators
• Bitwise Operators
• Assignment Operators
• Ternary or Conditional Operators
• sizeof operator
Arithmetic operator
Example (int A=8,
Operator B=3) Result

+ A+B 11

- A-B 5

* A*B 24

/ A/B 2

% A%4 0
Relational operator
Example (int A=8,
Operators B=3) Result

< A<B False


<= A<=10 True
> A>B True
>= A<=B False
== A== B False
!= A!=(-4) True
Logical operators
Example (int A=8,
Operator B=3, C=-10) Result

&& (A<B) && (B>C) False

|| (B!=-C) || (A==B) True

! !(B<=-A) True
Truth table of Logical Operator

C1 C2 C1 && C1 || C2 !C1 !C2


C2
T T T T F F
T F F T F T
F T F T T F
F F F F T T
Increment and Decrement operators
• Increment Operators are used to increased the
value of the variable by one and Decrement
Operators are used to decrease the value of the
variable by one in C programs.
• For. Ex.
• a++ increment operator
• a-- decrement operator
Type of Increment Operator

• pre-increment ++a
• post-increment a++
• pre-decrement --a
• post-decrement a--
Assignment operator
Operator Example (int A=8, Result
B=3)

+= A+=B or A=A+B 11
-= A-=3 or A=A+3 5
*= A*=7 or A=A*7 56
/= A/=B or A=A/B 2
%= A%=5 or A=A%5 3
Value of b will be
=a=b
assigned to a
Ternary operator
• If any operator is used on three operands or
variable is known as Ternary Operator. It can
be represented with ? : . It is also called
as conditional operator
• For ex.
• Exp1?exp2:exp3
Sizeof Operator
• The sizeof operator is used to calculate the
size of data type or variables. This operator
returns the size of its variable in bytes.
• For example: sizeof(a), where a is interger, will
return 2.
Thank You

You might also like