condition statement

16
In The Name of ALLAH, The Most Gracious, The Most Merciful.

Upload: daniyal-khan

Post on 14-Feb-2017

11 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Condition Statement

In The Name of ALLAH, The Most Gracious, The Most Merciful.

Page 2: Condition Statement

Group Members

Minhaj Butt (0002)Daniyal Khan (0047)

Adeel Awan (0052)Syed Nasir Ali (0053)

Page 3: Condition Statement

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

Types of Conditions Statement

There are three types of Condition Statement.

• If Statement.• If-else Statement.• Nested If-else Statement.

Page 5: Condition Statement

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

Syntax

If ( Condition )Statement;

Page 7: Condition Statement

ExampleIf (a==10)

Printf ( “your choice is ten” );

And

If (a>b)Printf ( “a is maximum” );

Page 8: Condition Statement

Flowchart of If Statement

Page 9: Condition Statement

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

Syntax

If (condition)Statement 1;

ElseStatement 2;

Page 11: Condition Statement

ExampleIf ( a > b )

Printf ( “a is maximum” );Else

Printf ( “b is maximum” );And

If ( percentage>=60 )Printf ( “pass” );

ElsePrintf ( “fail” );

Page 12: Condition Statement

Flowchart of If-else Statement

Page 13: Condition Statement

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

SyntaxIf ( Condition 1 )

Statement 1;Else

If (Condition2 )Statement 2;

ElseStatement 3;

Page 15: Condition Statement

Flowchart of Nested If Statement

Page 16: Condition Statement