SlideShare a Scribd company logo
Operator  C# - Lec3 (Workshop on C# Programming: Learn to Build)
C#
Day 1
Lecture3: Operator
Arithmetic Operator
• +
• -
• *
• /
• %
• ++
• --
Arithmetic Operator
int a = 1, b = 2, c =3;
int d = a + b * c;
int e = d / c;
int f = d % b;
Console.WriteLine(d);
Console.WriteLine(e);
Console.WriteLine(f);
Console.ReadKey();
Arithmetic Operator
int a =5;
a = a+ 5;
Console.WriteLine(a);
Arithmetic Operator
int a =5;
a += 5;
Console.WriteLine(a);
Arithmetic Operator
int a =5;
a = a- 5;
Console.WriteLine(a);
Or,
int a =5;
a -= 5;
Console.WriteLine(a);
Arithmetic Operator
int a =5;
a = a * 5;
Console.WriteLine(a);
Or,
int a =5;
a *= 5;
Console.WriteLine(a);
Arithmetic Operator
int a =5;
a = a/ 5;
Console.WriteLine(a);
Or,
int a =5;
a /= 5;
Console.WriteLine(a);
Arithmetic Operator
• Pre-increment
int a =5;
++a;
Console.WriteLine(a);
Arithmetic Operator
• Pre-increment
int a = 5, int b;
b = ++a;
Console.WriteLine(a);
Console.WriteLine(b);
Arithmetic Operator
• Post-increment
int a =5;
a++;
Console.WriteLine(a);
Arithmetic Operator
• Post-increment
int a = 5, int b;
b = a++;
Console.WriteLine(a);
Console.WriteLine(b);
Arithmetic Operator
int u = 5; int v = 3;
int x = u++ + ++v + ++u;
Console.WriteLine(x);
Logical Operator
• &&
• ||
• !
Logical Operator
• Logical AND (&&)
bool res;
int num = 10, num1 = 20;
res = (num == num1) && (num>5);
Console.Writeline(res);
Logical Operator
• Logical OR (||)
bool res;
int num = 10, num1 = 20;
res = (num == num1) || (num>5);
Console.Writeline(res);
Relational Operator
• ==
• !=
• >
• <
• >=
• <=
Relational Operator
• Equal to (==)
bool res;
int num = 10, num1 = 20;
res = (num == num1) ;
Console.Writeline(“{0} == {1} returns {2}”, num, num1, res);
Relational Operator
• Not Equal to (!=)
bool res;
int num = 10, num1 = 20;
res = (num != num1) ;
Console.Writeline(“{0} != {1} returns {2}”, num, num1, res);
Relational Operator
• Greater than (>)
bool res;
int num = 10, num1 = 20;
res = (num > num1) ;
Console.Writeline(“{0} > {1} returns {2}”, num, num1, res);
Relational Operator
• Less than (<)
bool res;
int num = 10, num1 = 20;
res = (num < num1) ;
Console.Writeline(“{0} < {1} returns {2}”, num, num1, res);
Relational Operator
• Greater than or Equal to (>=)
bool res;
int num = 10, num1 = 20;
res = (num >= num1) ;
Console.Writeline(“{0} >= {1} returns {2}”, num, num1, res);
Relational Operator
• Less than or Equal to (<=)
bool res;
int num = 10, num1 = 20;
res = (num <= num1) ;
Console.Writeline(“{0} <= {1} returns {2}”, num, num1, res);
Assignment Operator
• =
• +=
• -=
• *=
• /=
• %=
• >>=
• <<=
• &=
• ^=
• |=
Assignment Operator
• Add AND Assignment Operator (+=)
int res;
int num = 10;
res += num;
Console.Writeline(“Result of res = {0}”, res);
Assignment Operator
• Left Shift AND Assignment Operator (<<=)
int res;
int num = 10;
res <<= num;
Console.Writeline(“Result of res = {0}”, res);
This slide is provided as a course material in the workshop named
“Workshop on C# Programming: Learn to Build”.
Organized by-
East West University Computer Programming Club (EWUCoPC)
Prepared by-
Jannat Binta Alam
Campus Ambassador
Young Engineers Society (YES)
E-mail: jannat.cse.ewu@gmail.com

More Related Content

What's hot (18)

Practical no 3
Practical no 3
Kshitija Dalvi
 
Factorial Program in C
Factorial Program in C
Hitesh Kumar
 
c++ program using All data type and operators
c++ program using All data type and operators
AMUDHAJAY
 
Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.
Hazrat Bilal
 
Practical no 5
Practical no 5
Kshitija Dalvi
 
ICP - Lecture 5
ICP - Lecture 5
Hassaan Rahman
 
MFC Calculator 2
MFC Calculator 2
Razvan Raducanu, PhD
 
C exam
C exam
mohamed salem
 
C prog1
C prog1
vyankateshbhaurkar
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
Practical no 1
Practical no 1
Kshitija Dalvi
 
เฉลยแบบฝึกหัดบทที่ 1
เฉลยแบบฝึกหัดบทที่ 1
โทโม๊ะจัง นานะ
 
Arithmetic operator
Arithmetic operator
Md Masudur Rahman
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Hazrat Bilal
 
Lab 1
Lab 1
emailharmeet
 
C operators
C operators
AbiramiT9
 
C program to add two numbers
C program to add two numbers
mohdshanu
 
C program to add n numbers
C program to add n numbers
mohdshanu
 
Factorial Program in C
Factorial Program in C
Hitesh Kumar
 
c++ program using All data type and operators
c++ program using All data type and operators
AMUDHAJAY
 
Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.
Hazrat Bilal
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Hazrat Bilal
 
C operators
C operators
AbiramiT9
 
C program to add two numbers
C program to add two numbers
mohdshanu
 
C program to add n numbers
C program to add n numbers
mohdshanu
 

Similar to Operator C# - Lec3 (Workshop on C# Programming: Learn to Build) (20)

03. operators and-expressions
03. operators and-expressions
Stoian Kirov
 
03. Operators Expressions and statements
03. Operators Expressions and statements
Intro C# Book
 
3 operators-expressions-and-statements-120712073351-phpapp01
3 operators-expressions-and-statements-120712073351-phpapp01
Abdul Samee
 
3 operators-expressions-and-statements-120712073351-phpapp01
3 operators-expressions-and-statements-120712073351-phpapp01
Abdul Samee
 
03 Operators and expressions
03 Operators and expressions
maznabili
 
Operators expressions-and-statements
Operators expressions-and-statements
CtOlaf
 
c# operators
c# operators
Micheal Ogundero
 
Operators
Operators
Kamran
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
Pooja Gupta
 
Lecture 2
Lecture 2
Soran University
 
C# Operators. (C-Sharp Operators)
C# Operators. (C-Sharp Operators)
Abid Kohistani
 
Lecture03 computer applicationsie1_dratifshahzad
Lecture03 computer applicationsie1_dratifshahzad
Atif Shahzad
 
C Sharp Jn (2)
C Sharp Jn (2)
guest58c84c
 
C Sharp Jn (2)
C Sharp Jn (2)
jahanullah
 
Operators and Expressions in C#
Operators and Expressions in C#
Prasanna Kumar SM
 
C sharp chap3
C sharp chap3
Mukesh Tekwani
 
11operator in c#
11operator in c#
Sireesh K
 
Operators and Expressions in C#
Operators and Expressions in C#
Simplilearn
 
Operator & Expression in c++
Operator & Expression in c++
bajiajugal
 
Operators in C#
Operators in C#
anshika shrivastav
 
03. operators and-expressions
03. operators and-expressions
Stoian Kirov
 
03. Operators Expressions and statements
03. Operators Expressions and statements
Intro C# Book
 
3 operators-expressions-and-statements-120712073351-phpapp01
3 operators-expressions-and-statements-120712073351-phpapp01
Abdul Samee
 
3 operators-expressions-and-statements-120712073351-phpapp01
3 operators-expressions-and-statements-120712073351-phpapp01
Abdul Samee
 
03 Operators and expressions
03 Operators and expressions
maznabili
 
Operators expressions-and-statements
Operators expressions-and-statements
CtOlaf
 
Operators
Operators
Kamran
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
Pooja Gupta
 
C# Operators. (C-Sharp Operators)
C# Operators. (C-Sharp Operators)
Abid Kohistani
 
Lecture03 computer applicationsie1_dratifshahzad
Lecture03 computer applicationsie1_dratifshahzad
Atif Shahzad
 
C Sharp Jn (2)
C Sharp Jn (2)
jahanullah
 
Operators and Expressions in C#
Operators and Expressions in C#
Prasanna Kumar SM
 
11operator in c#
11operator in c#
Sireesh K
 
Operators and Expressions in C#
Operators and Expressions in C#
Simplilearn
 
Operator & Expression in c++
Operator & Expression in c++
bajiajugal
 
Ad

More from Jannat Ruma (10)

Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Ad

Recently uploaded (20)

Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
BINARY files CSV files JSON files with example.pptx
BINARY files CSV files JSON files with example.pptx
Ramakrishna Reddy Bijjam
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
BINARY files CSV files JSON files with example.pptx
BINARY files CSV files JSON files with example.pptx
Ramakrishna Reddy Bijjam
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 

Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)