Professional Documents
Culture Documents
ET Week03 A
ET Week03 A
Week 03
Usman Akbar
usman.akbar@superior.edu.pk
FB Group - SuperiorUniversity2016
Lecture Content
Arithmetic Operators
+ - * / % ++ --
Relational Operators
== != > < >= <=
Logical Operators
&& || !
Assignment Operators
= += -= *= /=
if(boolean_expression)
{
/* statement(s) will execute if the boolean expression is
true */
}
if (boolean-expression-1)
{
// statements executed if boolean-expression-1 is
true
}
else if (boolean-expression-2)
{
// statements executed if boolean-expression-2 is
true
}
else if (boolean-expression-3)
{
// statements executed if boolean-expression-3 is
true
}
if (boolean-expression-1)
{
// statements executed if boolean-expression-1 is true
??
if (boolean-expression-2)
{
// statements executed if boolean-expression-2 is
true
}
}
switch (grade) {
case 'A':
Console.WriteLine("Excellent!");
break;
case 'B':
case 'C':
Console.WriteLine("Well done");
break;
case 'D':
Console.WriteLine("You passed");
break;
case 'F':
Console.WriteLine("Better try again");
break;
default:
Console.WriteLine("Invalid grade");
break;
EMERGING TECHNOLOGIES ( USMAN AKBAR ) 10
There are following assignment operators supported by C#
Questions….?
References