SlideShare a Scribd company logo
1 of 17
VARIABLES & EXPRESSIONS 
M3 COMPUTER SCIENCE CLASS – TERM 2 
THE PRINCE ROYAL'S COLLEGE
WHAT IS THE BASIC C# SYNTAX? 
BASIC C# SYNTAX: 
•C# code is made of a series of statements where 
each statement ends with a semicolon “;” 
• C# code is organized in “blocks”, which may 
contain any number of statements, and are 
bounded by braces “{” and “}”
LAYOUT OF A BLOCK OF CODE IN C# 
{ 
<code line 1, statement 1>; 
<code line 2, statement 2> 
<code line 3, statement 
2>; 
}
WHAT IS A COMMENT? 
•A comment is a descriptive text added to a 
code. It is not executed/run because it is not 
really part of the program code. 
•Examples: 
/* This is a comment */ 
// This is a different sort of comment. 
/// A special comment
WHAT ARE VARIABLES? 
•Variables store data which can be used and 
changed within a program; in C# they have to 
be assigned a name and a type first before they 
can be used in C# 
•C# syntax for declaring variables merely 
specifies the type and variable name: 
<type> <name>;
EXAMPLES OF VARIABLES: 
• Integer Types 
Type Alias For Allowed Values 
sbyte System.SByte Integer between −128 and 127 
byte System.Byte Integer between 0 and 255 
int System.Int32 Integer between −2147483648 and 2147483647 
uint System.UInt32 Integer between 0 and 4294967295 
long System.Int64 Integer between −9223372036854775808 and 
9223372036854775807 
ulong System.UInt64 Integer between 0 and 18446744073709551615
EXAMPLES OF VARIABLES: 
• Floating Types 
Type Alias For MIN/MAX Values 
float System.Single 1.5 × 10−45 / 3.4 × 1038 
double System.Double 5.0 × 10−324 / 1.7 × 10308 
decimal System.Decimal 1.0 × 10−28 / 7.9 × 1028 
• Text and Boolean Types 
Type Alias For Allowed Values 
char System.Char One Unicode character, stored as an integer 
between 0 and 65535 
bool System.Boolean Boolean value, true or false 
string System.String A sequence of characters
HOW DO YOU NAME VARIABLES? 
• The first character of a variable name must be either a 
letter, an underscore character(_), or the at symbol 
(@). 
• Next characters may be letters, underscore characters, 
or numbers. 
• C# is case sensitive, so be careful and remember the 
exact case used when you declare your variables.
WHAT ARE EXPRESSIONS? 
• Basic building blocks of computation made by 
combining variables and operators.
WHAT ARE OPERATORS? 
•Symbols that tells the compiler to perform 
specific mathematical or logical manipulations. 
• TYPES OF OPERATORS: 
• Arithmetic Operators 
• Relational Operators 
• Logical Operators 
• Bitwise Operators 
• Assignment Operators 
• Miscellaneous Operators
WHAT ARE OPERATORS? 
•Symbols that tells the compiler to perform 
specific mathematical or logical manipulations. 
• TYPES OF OPERATORS: 
• Arithmetic Operators 
• Relational Operators 
• Logical Operators 
• Bitwise Operators 
• Assignment Operators 
• Miscellaneous Operators
MATH OPERATORS: 
Operat 
Sample Result 
or 
+ var1 = var2 + 
var3; 
var1 is assigned the value that is the sum of var2 and var3 
- var1 = var2 - 
var3; 
var1 is assigned the value that is the value of var3 
subtracted from the value of var2 
* var1 = var2 * 
var3; 
var1 is assigned the value that is the product of var2 and 
var3. 
/ var1 = var2 / 
var3; 
var1 is assigned the value that is the result of dividing var2 
by var3 
% var1 = var2 % 
var3; 
var1 is assigned the value that is the remainder when var2 
is divided by var3
STRING CONCATENATION OPERATOR: 
Operat 
Sample Result 
or 
+ var1 = var2 + 
var3; 
var1 is assigned the value that is the concatenation 
of the two strings stored in var2 and var3 
INCREMENT AND DECREMENT OPERATORS: 
Operat 
Sample Result 
or 
++ var1 = ++var2; 
var1 is assigned the value of var2 + 1. var2 is increased by 
var1 = var2++; 1 
-- var1 = --var2; var1 is assigned the value of var2 - 1. var2 is decreased by 
var1 = var2--; 1
ASSIGNMENT OPERATORS: 
Operat 
Sample Result 
or 
= var1 = var2; var1 is assigned the value of var2 
+= var1 += var2; var1 is assigned the value that is the sum ofvar1 and var2 
-= var1 -= var2; var1 is assigned the value that is the value of var2 
subtracted from the value of var1. 
*= var1 *= var2; var1 is assigned the value that is the product of var1 and 
var2. 
/= var1 /= var2; var1 is assigned the value that is the concatenation 
of the two strings stored in var2 and var3. 
%= var1 %= var2; var1 is assigned the value that is the remainder when var1 
is divided by var2
ORDER OF OPERATORS: 
Priority Operators 
Highest ++, -- (used as prefixes); +, - (unary) 
*, /, % 
+, - 
=, *=, /=, %=, +=, -= 
Lowest ++, -- (used as suffixes)
SOURCES 
• "Tutorials Point." C# Tutorial. N.p., n.d. Web. 20 Nov. 2014. 
• "Variables." The Complete C# Tutorial. N.p., n.d. Web. 20 Nov. 
2014. 
• "C# Programming." Wikibooks. N.p., n.d. Web. 20 Nov. 2014. 
• Watson, Karli, Jacob Vibe Hammer, John D. Reid, Morgan 
Skinner, Daniel Kemper, and Christian Nagel. Beginning Visual 
C#® 2012 Programming. Indianapolis: John Wiley and Sons, 
2013. Print.
THE END

More Related Content

What's hot

Variable, constant, operators and control statement
Variable, constant, operators and control statementVariable, constant, operators and control statement
Variable, constant, operators and control statement
Eyelean xilef
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
Jomel Penalba
 
Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagrams
babak danyal
 

What's hot (19)

5 Statements and Control Structures
5 Statements and Control Structures5 Statements and Control Structures
5 Statements and Control Structures
 
Variable, constant, operators and control statement
Variable, constant, operators and control statementVariable, constant, operators and control statement
Variable, constant, operators and control statement
 
Basic
BasicBasic
Basic
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
 
Unit 5. Control Statement
Unit 5. Control StatementUnit 5. Control Statement
Unit 5. Control Statement
 
Ch03
Ch03Ch03
Ch03
 
Control structures in C++ Programming Language
Control structures in C++ Programming LanguageControl structures in C++ Programming Language
Control structures in C++ Programming Language
 
Programming in Oracle with PL/SQL
Programming in Oracle with PL/SQLProgramming in Oracle with PL/SQL
Programming in Oracle with PL/SQL
 
Moneeba Anwar
Moneeba AnwarMoneeba Anwar
Moneeba Anwar
 
Control structure C++
Control structure C++Control structure C++
Control structure C++
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity rule
 
Control Structures: Part 1
Control Structures: Part 1Control Structures: Part 1
Control Structures: Part 1
 
Functions
FunctionsFunctions
Functions
 
Token and operators
Token and operatorsToken and operators
Token and operators
 
Ch02
Ch02Ch02
Ch02
 
Lecture#08 sequence diagrams
Lecture#08 sequence diagramsLecture#08 sequence diagrams
Lecture#08 sequence diagrams
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Introfamilyofcurves
IntrofamilyofcurvesIntrofamilyofcurves
Introfamilyofcurves
 

Viewers also liked

5 lesson 2 1 variables & expressions
5 lesson 2 1 variables & expressions5 lesson 2 1 variables & expressions
5 lesson 2 1 variables & expressions
mlabuski
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
Nitu Pandey
 
Variable and Algebraic Expressions
Variable and Algebraic ExpressionsVariable and Algebraic Expressions
Variable and Algebraic Expressions
Yelena Melnichenko
 
6th grade math algebra
6th grade math algebra6th grade math algebra
6th grade math algebra
gwl10925
 
Algebraic expressions
Algebraic expressionsAlgebraic expressions
Algebraic expressions
Manav Gupta
 

Viewers also liked (20)

Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
Lesson 2 Understanding Types And Usage In Dot Net
Lesson 2    Understanding Types And Usage In Dot NetLesson 2    Understanding Types And Usage In Dot Net
Lesson 2 Understanding Types And Usage In Dot Net
 
SmartBoard Lesson Plans
SmartBoard Lesson PlansSmartBoard Lesson Plans
SmartBoard Lesson Plans
 
Sedev 1
Sedev 1Sedev 1
Sedev 1
 
5 lesson 2 1 variables & expressions
5 lesson 2 1 variables & expressions5 lesson 2 1 variables & expressions
5 lesson 2 1 variables & expressions
 
Lesson 1 Understanding Dot Net Framework
Lesson 1   Understanding Dot Net FrameworkLesson 1   Understanding Dot Net Framework
Lesson 1 Understanding Dot Net Framework
 
Lec1
Lec1Lec1
Lec1
 
Lesson plan
Lesson planLesson plan
Lesson plan
 
PHP Basic & Variables
PHP Basic & VariablesPHP Basic & Variables
PHP Basic & Variables
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
Variable and Algebraic Expressions
Variable and Algebraic ExpressionsVariable and Algebraic Expressions
Variable and Algebraic Expressions
 
6th grade math algebra
6th grade math algebra6th grade math algebra
6th grade math algebra
 
C# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-12-slidesC# Tutorial MSM_Murach chapter-12-slides
C# Tutorial MSM_Murach chapter-12-slides
 
Mastering python lesson2
Mastering python lesson2Mastering python lesson2
Mastering python lesson2
 
Algebraic expression
Algebraic expressionAlgebraic expression
Algebraic expression
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 
Semi Detailed Lesson Plan in Programming Languages
Semi Detailed Lesson Plan in Programming LanguagesSemi Detailed Lesson Plan in Programming Languages
Semi Detailed Lesson Plan in Programming Languages
 
Introduction to .NET Framework and C# (English)
Introduction to .NET Framework and C# (English)Introduction to .NET Framework and C# (English)
Introduction to .NET Framework and C# (English)
 
Algebraic expressions
Algebraic expressionsAlgebraic expressions
Algebraic expressions
 

Similar to Lesson 3: Variables and Expressions

Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11
Syed Asrarali
 
03 expressions.ppt
03 expressions.ppt03 expressions.ppt
03 expressions.ppt
Business man
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
Tony Apreku
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
Ashwin Kumar
 

Similar to Lesson 3: Variables and Expressions (20)

Java chapter 2
Java chapter 2Java chapter 2
Java chapter 2
 
Chapter 2 java
Chapter 2 javaChapter 2 java
Chapter 2 java
 
Pj01 3-java-variable and data types
Pj01 3-java-variable and data typesPj01 3-java-variable and data types
Pj01 3-java-variable and data types
 
Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11
 
PL_SQL - II.pptx
PL_SQL - II.pptxPL_SQL - II.pptx
PL_SQL - II.pptx
 
Operators loops conditional and statements
Operators loops conditional and statementsOperators loops conditional and statements
Operators loops conditional and statements
 
lec 2.pptx
lec 2.pptxlec 2.pptx
lec 2.pptx
 
Basic elements of java
Basic elements of java Basic elements of java
Basic elements of java
 
Ma3696 Lecture 3
Ma3696 Lecture 3Ma3696 Lecture 3
Ma3696 Lecture 3
 
03 expressions.ppt
03 expressions.ppt03 expressions.ppt
03 expressions.ppt
 
Ifi7107 lesson4
Ifi7107 lesson4Ifi7107 lesson4
Ifi7107 lesson4
 
C language
C languageC language
C language
 
SAS Macro
SAS MacroSAS Macro
SAS Macro
 
Computer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statementsComputer programming - variables constants operators expressions and statements
Computer programming - variables constants operators expressions and statements
 
Variables - Arduino Programming Robotics
Variables - Arduino Programming RoboticsVariables - Arduino Programming Robotics
Variables - Arduino Programming Robotics
 
Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.
 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
 

More from "Filniño Edmar Ambos" (8)

Computer class rules
Computer class rulesComputer class rules
Computer class rules
 
Math Class (System.Math)
Math Class (System.Math)Math Class (System.Math)
Math Class (System.Math)
 
Banner Design Tips
Banner Design TipsBanner Design Tips
Banner Design Tips
 
Introduction to Desktop Applications In C#
Introduction to Desktop Applications In C# Introduction to Desktop Applications In C#
Introduction to Desktop Applications In C#
 
Photoshop Poster Color Tips for M1 Class
Photoshop Poster Color Tips for M1 ClassPhotoshop Poster Color Tips for M1 Class
Photoshop Poster Color Tips for M1 Class
 
Var and Ops quiz
Var and Ops quizVar and Ops quiz
Var and Ops quiz
 
Lesson 2: Introduction to C#
Lesson 2: Introduction to C#Lesson 2: Introduction to C#
Lesson 2: Introduction to C#
 
Lesson1: Introduction to Programming
Lesson1: Introduction to ProgrammingLesson1: Introduction to Programming
Lesson1: Introduction to Programming
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Lesson 3: Variables and Expressions

  • 1. VARIABLES & EXPRESSIONS M3 COMPUTER SCIENCE CLASS – TERM 2 THE PRINCE ROYAL'S COLLEGE
  • 2. WHAT IS THE BASIC C# SYNTAX? BASIC C# SYNTAX: •C# code is made of a series of statements where each statement ends with a semicolon “;” • C# code is organized in “blocks”, which may contain any number of statements, and are bounded by braces “{” and “}”
  • 3. LAYOUT OF A BLOCK OF CODE IN C# { <code line 1, statement 1>; <code line 2, statement 2> <code line 3, statement 2>; }
  • 4. WHAT IS A COMMENT? •A comment is a descriptive text added to a code. It is not executed/run because it is not really part of the program code. •Examples: /* This is a comment */ // This is a different sort of comment. /// A special comment
  • 5. WHAT ARE VARIABLES? •Variables store data which can be used and changed within a program; in C# they have to be assigned a name and a type first before they can be used in C# •C# syntax for declaring variables merely specifies the type and variable name: <type> <name>;
  • 6. EXAMPLES OF VARIABLES: • Integer Types Type Alias For Allowed Values sbyte System.SByte Integer between −128 and 127 byte System.Byte Integer between 0 and 255 int System.Int32 Integer between −2147483648 and 2147483647 uint System.UInt32 Integer between 0 and 4294967295 long System.Int64 Integer between −9223372036854775808 and 9223372036854775807 ulong System.UInt64 Integer between 0 and 18446744073709551615
  • 7. EXAMPLES OF VARIABLES: • Floating Types Type Alias For MIN/MAX Values float System.Single 1.5 × 10−45 / 3.4 × 1038 double System.Double 5.0 × 10−324 / 1.7 × 10308 decimal System.Decimal 1.0 × 10−28 / 7.9 × 1028 • Text and Boolean Types Type Alias For Allowed Values char System.Char One Unicode character, stored as an integer between 0 and 65535 bool System.Boolean Boolean value, true or false string System.String A sequence of characters
  • 8. HOW DO YOU NAME VARIABLES? • The first character of a variable name must be either a letter, an underscore character(_), or the at symbol (@). • Next characters may be letters, underscore characters, or numbers. • C# is case sensitive, so be careful and remember the exact case used when you declare your variables.
  • 9. WHAT ARE EXPRESSIONS? • Basic building blocks of computation made by combining variables and operators.
  • 10. WHAT ARE OPERATORS? •Symbols that tells the compiler to perform specific mathematical or logical manipulations. • TYPES OF OPERATORS: • Arithmetic Operators • Relational Operators • Logical Operators • Bitwise Operators • Assignment Operators • Miscellaneous Operators
  • 11. WHAT ARE OPERATORS? •Symbols that tells the compiler to perform specific mathematical or logical manipulations. • TYPES OF OPERATORS: • Arithmetic Operators • Relational Operators • Logical Operators • Bitwise Operators • Assignment Operators • Miscellaneous Operators
  • 12. MATH OPERATORS: Operat Sample Result or + var1 = var2 + var3; var1 is assigned the value that is the sum of var2 and var3 - var1 = var2 - var3; var1 is assigned the value that is the value of var3 subtracted from the value of var2 * var1 = var2 * var3; var1 is assigned the value that is the product of var2 and var3. / var1 = var2 / var3; var1 is assigned the value that is the result of dividing var2 by var3 % var1 = var2 % var3; var1 is assigned the value that is the remainder when var2 is divided by var3
  • 13. STRING CONCATENATION OPERATOR: Operat Sample Result or + var1 = var2 + var3; var1 is assigned the value that is the concatenation of the two strings stored in var2 and var3 INCREMENT AND DECREMENT OPERATORS: Operat Sample Result or ++ var1 = ++var2; var1 is assigned the value of var2 + 1. var2 is increased by var1 = var2++; 1 -- var1 = --var2; var1 is assigned the value of var2 - 1. var2 is decreased by var1 = var2--; 1
  • 14. ASSIGNMENT OPERATORS: Operat Sample Result or = var1 = var2; var1 is assigned the value of var2 += var1 += var2; var1 is assigned the value that is the sum ofvar1 and var2 -= var1 -= var2; var1 is assigned the value that is the value of var2 subtracted from the value of var1. *= var1 *= var2; var1 is assigned the value that is the product of var1 and var2. /= var1 /= var2; var1 is assigned the value that is the concatenation of the two strings stored in var2 and var3. %= var1 %= var2; var1 is assigned the value that is the remainder when var1 is divided by var2
  • 15. ORDER OF OPERATORS: Priority Operators Highest ++, -- (used as prefixes); +, - (unary) *, /, % +, - =, *=, /=, %=, +=, -= Lowest ++, -- (used as suffixes)
  • 16. SOURCES • "Tutorials Point." C# Tutorial. N.p., n.d. Web. 20 Nov. 2014. • "Variables." The Complete C# Tutorial. N.p., n.d. Web. 20 Nov. 2014. • "C# Programming." Wikibooks. N.p., n.d. Web. 20 Nov. 2014. • Watson, Karli, Jacob Vibe Hammer, John D. Reid, Morgan Skinner, Daniel Kemper, and Christian Nagel. Beginning Visual C#® 2012 Programming. Indianapolis: John Wiley and Sons, 2013. Print.