condition statement
TRANSCRIPT
![Page 1: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/1.jpg)
In The Name of ALLAH, The Most Gracious, The Most Merciful.
![Page 2: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/2.jpg)
Group Members
Minhaj Butt (0002)Daniyal Khan (0047)
Adeel Awan (0052)Syed Nasir Ali (0053)
![Page 3: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/3.jpg)
Condition StatementCondition Statement are used to execute a set of statement
on some conditions. If the condition is true then the set
of statement are executed otherwise the body is skipped.
![Page 4: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/4.jpg)
Types of Conditions Statement
There are three types of Condition Statement.
• If Statement.• If-else Statement.• Nested If-else Statement.
![Page 5: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/5.jpg)
If StatementIf statement is conditional statement. It is use to execute a statement or a set of statement against a given condition. If given condition is true the assosiative statement will execute. It is used for one way decision making.
![Page 6: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/6.jpg)
Syntax
If ( Condition )Statement;
![Page 7: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/7.jpg)
ExampleIf (a==10)
Printf ( “your choice is ten” );
And
If (a>b)Printf ( “a is maximum” );
![Page 8: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/8.jpg)
Flowchart of If Statement
![Page 9: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/9.jpg)
If-else StatementIf-else statement is conditional statement. It is used for two way decision making. There is one condition and two decision. If given condition is true then first decision will execute and second will be ignored. If given condition is false then first decision will be ignored and the second decision will be executed.
![Page 10: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/10.jpg)
Syntax
If (condition)Statement 1;
ElseStatement 2;
![Page 11: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/11.jpg)
ExampleIf ( a > b )
Printf ( “a is maximum” );Else
Printf ( “b is maximum” );And
If ( percentage>=60 )Printf ( “pass” );
ElsePrintf ( “fail” );
![Page 12: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/12.jpg)
Flowchart of If-else Statement
![Page 13: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/13.jpg)
Nested If-else Statement
An If statement which is written within another if or if-else statement is called Nested if statement .
![Page 14: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/14.jpg)
SyntaxIf ( Condition 1 )
Statement 1;Else
If (Condition2 )Statement 2;
ElseStatement 3;
![Page 15: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/15.jpg)
Flowchart of Nested If Statement
![Page 16: Condition Statement](https://reader036.vdocuments.site/reader036/viewer/2022091121/58a2d7801a28ab692e8b6201/html5/thumbnails/16.jpg)