1) If Statement
+Syntax
+Example
+Flowchart
2) If Else Statement
+Syntax
+Example
+Flowchart
3) Nested If Else Statement
+Syntax
+Flowchart.
Size: 204.88 KB
Language: en
Added: Jan 17, 2017
Slides: 16 pages
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;