Module 4 CE Computer Fundamentals Programming
Module 4 CE Computer Fundamentals Programming
Computer Fundamentals
Programming
Module 4 – Conditional Statements
• if statement
• if…else statement
• else if statement
• switch statement
if statement
4
Syntax:
if(boolean_expression)
{
/* statement(s) will execute
if the boolean expression is true
*/
}
Sample Problem #1
using System;
class my_app
{
static void Main(string[] args)
{
string Age = "";
Syntax:
if(boolean_expression)
{
/* statement(s) will execute if
the boolean expression is true */
}
else
{
/* statement(s) will execute if
the boolean expression is false */
}
Sample Problem #2
Console.ReadKey();
}
}
nested if……
8
Sample Problem #3
Console.ReadKey();
}
}
10
Computer Fundamentals
Programming
Module 5 – C# Loops
• A loop statement
allows us to execute a
statement or a group
of statements
multiple times and
following is the
general form of a loop
statement in most of
the programming
languages
Loop Types and Description
13