Learning C Programming || C Flow Control-C if-else Statement || For Beginners || #C127
In programming, decision making is used to specify the order in which statements are executed. In this tutorial, you will learn to write if...else statements to make decisions in your program.
Table of Contents
if Statement
Example: if Statement
if...else Statement
Example: if...else Statement
if...else Ladder
Example: if...else Ladder
Nested if...else
Example: Nested if...else
C if statement
How if statement works?
The if statement evaluates the test expression inside the parenthesis.
If the test expression is evaluated to true (nonzero), statement(s) inside the body of if is executed.
If the test expression is evaluated to false (0), statement(s) inside the body of if is skipped from execution.
C if...else statement
The if statement may have an optional else block. The syntax of if..else statement is:
How if...else statement works?
If test expression is evaluated to true,
statement(s) inside the body of if statement is executed
statement(s) inside the body of else statement is skipped from execution.
If test expression is evaluated to false,
statement(s) inside the body of else statement is executed
statement(s) inside the body of if statement is skipped.
if...else Ladder (if...else if....else Statement)
The if...else statement executes two different codes depending upon whether the test expression is true or false. Sometimes, a choice has to be made from more than 2 possibilities.
The if...else ladder allows you to check for multiple test expressions and execute different statement(s).
Nested if...else
It is possible to include if...else statement(s) inside the body of another if...else statement.
INTRODUCTION
Keywords & Identifier
Variables & Constants
C Data Types
C Input/Output
C Operators
FLOW CONTROL
if...else Statement
C for Loop
C while Loop
break and continue
switch Statement
#rubalsolutions #coding #developer #programming #programmer #technology #clanguage #computerscience #c #informaticpractices #sub #subscribe #youtube #newyoutuber #youtubechannel