C Programming Tutorial #06 Conditional Statements: if, if else, cascading if, switch

preview_player
Показать описание
C Programming Tutorial #06 Conditional Statements: if, if else, cascading if, switch. In 6th lecture of C Programming, we will enter the uncertain world of conditional statements, where one of multiple statements can be executed depending on a condition. You will learn about the important “if” statement and the useful “switch” statement.
This c programming lecture contains the following topics:
- Conditional statements
- Selection statements
- if, if then, if then else, cascading if
- switch statement; correct and incorrect usages

00:25 Selection/ Conditional Statements: Conditional Statement (also called Condition) is a feature of programming language , which allows it to perform actions depending upon some conditions provided by the programmer. Conditional statement controls the sequence of statements depending on the condition.
The different types of conditional statements in C language are as follows:
1. if statement
2. if else statement
3. else if statement
4. nested if-else statement
5. switch statement
6. goto statement

02:20 if Statement: The if statement gives the user the choice of executing a statement (possibly compound) if the expression is evaluated to true or skipping it is the expression is evaluated to false.
05:33 Write a C program to find out if it is multiple of 3 (Without ELSE clause)
10:35 Write a C program to find out if it is multiple of 3 (With ELSE clause)
13:45 cascading if: Explained with example
15:30 Nested if Explained with example
18:02 Switch Statement: Switch is a multiple or multiway brancing decision making statement. When we use nested if-else statement to check more than 1 conditions then the complexity of a program increases in case of a lot of conditions. Thus, the program is difficult to read and maintain. So to overcome this problem, C provides 'switch case'. Switch case checks the value of a expression against a case values, if condition matches the case values then the control is transferred to that point.

Рекомендации по теме