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

PPTX
C++ operator
PPTX
How c program execute in c program
PPTX
Phpbase
PPTX
Arithmetic and Arithmetic assignment operators
PDF
Programming meeting #4
DOCX
Assignment no 5
PDF
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی
C++ operator
How c program execute in c program
Phpbase
Arithmetic and Arithmetic assignment operators
Programming meeting #4
Assignment no 5
اسلاید دوم جلسه پنجم کلاس پایتون برای هکرهای قانونی

What's hot (18)

DOCX
Practical no 3
PDF
Factorial Program in C
PDF
c++ program using All data type and operators
DOCX
Printing different pyramid patterns of numbers,alphabets and stars using C.
DOCX
Practical no 5
PDF
ICP - Lecture 5
PPTX
MFC Calculator 2
PDF
PDF
PDF
Infix to Prefix (Conversion, Evaluation, Code)
DOCX
Practical no 1
DOCX
เฉลยแบบฝึกหัดบทที่ 1
PDF
Arithmetic operator
DOC
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
PPT
PPTX
C operators
DOC
C program to add two numbers
DOC
C program to add n numbers
Practical no 3
Factorial Program in C
c++ program using All data type and operators
Printing different pyramid patterns of numbers,alphabets and stars using C.
Practical no 5
ICP - Lecture 5
MFC Calculator 2
Infix to Prefix (Conversion, Evaluation, Code)
Practical no 1
เฉลยแบบฝึกหัดบทที่ 1
Arithmetic operator
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
C operators
C program to add two numbers
C program to add n numbers
Ad

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

PPTX
03. Operators Expressions and statements
PPTX
Operators expressions-and-statements
PPTX
3 operators-expressions-and-statements-120712073351-phpapp01
PPTX
3 operators-expressions-and-statements-120712073351-phpapp01
PPTX
PROGRAMMING IN C - Operators.pptx
PPTX
03. operators and-expressions
PPT
c++ Lecture 2
PPTX
C - programming - Ankit Kumar Singh
PPTX
operators_group_2[1].pptx PLEASE DOWNLOAD
PPTX
Operators-computer programming and utilzation
PDF
Developer Experience i TypeScript. Najbardziej ikoniczne duo
PDF
convert the following C code to Mips assembly with steps and comment.pdf
PPTX
1 introduction to c program
PPTX
Operators
DOCX
.net progrmming part2
PPTX
Operators1.pptx
03. Operators Expressions and statements
Operators expressions-and-statements
3 operators-expressions-and-statements-120712073351-phpapp01
3 operators-expressions-and-statements-120712073351-phpapp01
PROGRAMMING IN C - Operators.pptx
03. operators and-expressions
c++ Lecture 2
C - programming - Ankit Kumar Singh
operators_group_2[1].pptx PLEASE DOWNLOAD
Operators-computer programming and utilzation
Developer Experience i TypeScript. Najbardziej ikoniczne duo
convert the following C code to Mips assembly with steps and comment.pdf
1 introduction to c program
Operators
.net progrmming part2
Operators1.pptx
Ad

More from Jannat Ruma (10)

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

Recently uploaded (20)

PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
IP : I ; Unit I : Preformulation Studies
PPTX
Climate Change and Its Global Impact.pptx
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
English Textual Question & Ans (12th Class).pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PPTX
Education and Perspectives of Education.pptx
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
semiconductor packaging in vlsi design fab
PPTX
Module on health assessment of CHN. pptx
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
HVAC Specification 2024 according to central public works department
IP : I ; Unit I : Preformulation Studies
Climate Change and Its Global Impact.pptx
My India Quiz Book_20210205121199924.pdf
A powerpoint presentation on the Revised K-10 Science Shaping Paper
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
English Textual Question & Ans (12th Class).pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
Education and Perspectives of Education.pptx
Cambridge-Practice-Tests-for-IELTS-12.docx
Core Concepts of Personalized Learning and Virtual Learning Environments
semiconductor packaging in vlsi design fab
Module on health assessment of CHN. pptx

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