control statement in c programming vijay
DESCRIPTION
Control Statement in C Programming VijayTRANSCRIPT
MultimediaMultimediaHelp you to learn anything in a playful manner………….
Slide Created by :-Vijay Kumar Sharma
Enrolment No :- 073575052
Course & Batch :- BCA 4/2
Subject Code :- CS-66
Control Statement Control Statement in C Programmingin C Programming
C programming language is popular C programming language is popular
for its capability of decision making.for its capability of decision making.
Now we are going to learn about Now we are going to learn about
“Control State in C Programming”“Control State in C Programming”
Control Statement in C Control Statement in C ProgrammingProgramming
If StatementIf Statement
Multiple If StatementsMultiple If Statements
If-else StatementIf-else Statement
Nested if-elseNested if-else
The If The If StatementStatement
Like most programming languages, C Like most programming languages, C uses the keyword if to implement the uses the keyword if to implement the decision control instruction. The decision control instruction. The general form of if state look like thisgeneral form of if state look like this
If(this condition is true)If(this condition is true)
execute this statement;execute this statement;
Multiple Statement With Multiple Statement With in Ifin If
It may happen that in a program we It may happen that in a program we want more than one statement to be want more than one statement to be executed if the expression following if is executed if the expression following if is satisfied. Then statement will be like satisfied. Then statement will be like thisthis
If(condition)If(condition)
{{
Statement;Statement;
Statement;Statement;
Statement;Statement;
}}
If-else If-else StatementStatement
We execute one group of statement of if the expression evaluates to true and another group of statement if the expression evaluates to false? Of course! This is what is the purpose of the else statement that is demonstrated in the following syntax
If(condition)Do this;
Else Do this;
Nested if-elseNested if-elseIt is perfectly all right if we write an entire if-It is perfectly all right if we write an entire if-else construct within either the body of the if else construct within either the body of the if statement or the body of an else statement. statement or the body of an else statement. This is called “Nesting” syntax is belowThis is called “Nesting” syntax is below
If(condition)If(condition)Do this;Do this;
ElseElse{ if(condition){ if(condition)Do this;Do this;
ElseElseDo thisDo this
}}