Lecture 05-06 (Literals, Variables, Operators, Dicision Making, Branching)
Lecture 05-06 (Literals, Variables, Operators, Dicision Making, Branching)
Operators
Data types in
Literals Variables and
C#.
Expressions.
C# Literals
-> Escape Sequence Examples are presented on
the next slide
9
Variables (contd.)
10
Datatypes
11
Datatypes (contd.)
12
Taxonomy C# datatypes
13
Declaration of variables
14
Default values
15
Default values (contd.)
16
Constant variables
17
Scope of variables
18
Scope of variables (contd.)
19
Boxing and Unboxing
20
Boxing
21
Boxing (contd.)
22
Unboxing
23
Types of operators
24
Arithmetic operators
25
Relational operators
26
Logical operators
27
Assignment Operator
28
Assignment Operator (contd.)
29
C# unary mathematical
operators
30
Prefix and postfix modes
31
Conditional operator
32
Operator precedence and parenthesis
33
Type conversion
34
Mathematical functions
35
CS-404 Visual Programming
Lecture 06 (Decision making and branching in C#)
Course Teacher: Awais Mehmood, Department of Computer Science, UET, Taxila (Pakistan)
DEPARTMENT OF COMPUTER SCIENCE, UET TAXILA (PAKISTAN) 36
Goals for
today
DECISION MAKING AND
BRANCHING IN C#
38
Flowchart of simple if control
39
The IF-ELSE Statement
40
Flowchart of if-else control
41
Nesting of if-else statement
42
Flowchart of nested if-else statement
43
The Else-if ladder
44
The switch statement
45
46
Example
Fallthrough in switch
statement
47
Tasks (Assignment 1)
1 2 3
Write a program that Write a program that Write a program
counts total even & finds the largest that finds the grade
odd numbers stored among 3 numbers of a student using
in an array ‘number’. using nested if..else else if ladder.
statement.