Condition Statement

DaniyalKhan64 176 views 16 slides Jan 17, 2017
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

1) If Statement
+Syntax
+Example
+Flowchart
2) If Else Statement
+Syntax
+Example
+Flowchart
3) Nested If Else Statement
+Syntax
+Flowchart.


Slide Content

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

Group Members Minhaj Butt (0002 ) Daniyal Khan (0047) Adeel Awan (0052) Syed Nasir Ali (0053 )

Condition Statement Condition 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.

Types of Conditions Statement There are three types of Condition Statement. If Statement. If-else Statement. Nested If-else Statement.

If Statement If 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.

Syntax If ( Condition ) Statement;

Example If (a==10) Printf ( “your choice is ten” ); And If (a>b) Printf ( “a is maximum” );

Flowchart of If Statement

If-else Statement If-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.

Syntax If (condition) Statement 1; Else Statement 2;

Example If ( a > b ) Printf ( “a is maximum” ); Else Printf ( “b is maximum” ); And If ( percentage>= 60 ) Printf ( “pass” ); Else Printf ( “fail” );

Flowchart of If-else Statement

Nested If-else Statement An If statement which is written within another if or if-else statement is called Nested if statement .

Syntax If ( Condition 1 ) Statement 1; Else If (Condition2 ) Statement 2; Else Statement 3;

Flowchart of Nested If Statement
Tags