SIZ Education || what are statements in C language || 27 /10/2021 ||
💠 WHAT IS STATEMENT
A statement is a command issued to the computer that tells it to do something specific, such as display something on the screen or gather data. A succession of assertions make up a computer programme.
🔵 SOME TYPES THAT WE DISSCUSS TODAY:
- IF ELSE STATEMENT
- ELSE..IF STATEMENT
- NESTED IF..ELSE STATEMENT
💠 IF ELSE STATEMENT
In C, the if-else statement is used to carry out operations based on a **set of conditions??. If and only if the supplied condition is true, the operations stated in the if block are executed.
SYNTAX OF IF ELSE:-
if(condition) {
Statements
}
else {
Statements
}
getch();
If the condition is true, the words in the body of the “if” statement are performed, while the statements in the body of the “else” statement are bypassed.If the condition is false, the words in the body of the "if" are skipped and the statements in "otherwise" are performed.
WORKING:-
💠 ELSE..IF STATEMENT
When you need to verify numerous conditions within a programme, the else..if statement comes in handy. It allows you to avoid layering of if-else blocks.
SYNTAX OF ELSE..IF:-
if (condition1)
{
These statements run if the condition1 is true
}
else if(condition2)
{
These statement run if the condition 2 is true
}
else if (condition3)
{
These statements run if the condition 3 is true
}
.
.
else
{
These statements run if all the conditions return false
}
getch();
WORKING:-
💠 NESTED ELSE..IF STATEMENT
Nested if else is when an if else statement appears within the body of another "if" or "else" statement.
SYNTAX OF NESTED ELSE..ID :-
if(condition)
{
Nested if else in if
if(condition2)
{
Statements
}
else {
Statements
}
}
else {
Statements
}
getch();
WORKING:-
Other Details:-
Topic | WHAT ARE STATEMENTS IN C LANGUAGE |
---|---|
COMMUNITY | STEEM INFINITY ZONE |
Location | (OKARA) PAKISTAN |
AURTHOR | @malikusman1 ME |
AURTHOR PICTURE |
💠 MY ACHIEVEMENT 1
https://steemit.com/hive-172186/@malikusman1/achievement-1-by-introduction-malikusman1
THANKS FOR YOUR SUPPORT DEAR SIZ TEAM
Cc.-
@cryptokraze
@siz-official
@vvarishayy
@arie.steem
@suboohi
Good working dear friend keep it up bro and keep learn with our steem fellows.
Regards, Faran Nabeel