SlideShare a Scribd company logo
conditional Statement
Presented by :
khwajaaghakarimy77@gmail.com
Intruduction conditional statement
The topic we’ll present >>>
What conditional statements ?
What is Types conditional statements?
If statements with example
If else statement with example
Nested if with example
Switch
Loop
 What is conditional?
 The conditional statement are used to execute the or
(ignore) a set of statement after testing the a condition
 The condition statement are also called selection
statement
 Usage of conditional statement in life ?
 I am learning c, c++ I am confuse how it work in real life
 In programming each function have a reason
 Lets say about conditional statement
 A user going to signing up for Facebook bout we don't
want the users signing up of age less than 15 years old. If
user age is less than 15 it should terminate the sign up
page and give a reason saying
 “sorry your too Young”
 Here we use if else statement behind situation
If statement ?
 If statement is used to execute or ignore a set
of statement after testing the condition
 Syntax
 if(condition)
 Statement -1;
 Statement -2;
Program of If Statement?
If else statement ??
Program of If-else statement??
If –else statement example in real life??
 If it id raining I shall not water the plants , else I have
to water the plants.
 now we can write it in pseudo code
 If (raining == true)
 Do not water
 Else
 Do water
Nested if statement
Nested if
When an if statement is used within another if statement it is called nested
statement.
If the condition-1 is true then the control shift to the next if statement and
the condition-2 is tested
If the condition-2 is true then the statement-2 is execute
The control will pass to statement -3 and this statement will execute
If the condition-2 is false thestatement-2 is skipped and the control shift to
the statement-3 and it will execute.
Syntax:
If (condition-1)
{
If (condition-2)
{
statement-2
}
Conditon-3
Example of nested if in real life
If a boy age is more the 18
if his nationality was Afghan
than he can give the vote in election
now we change it in pseudo code
if (age>18)
{
if (nationality ==‘Afghan’)
cout<<“you Can Give the Voten”;
}
else
Cout<<“you can not give the vote”;
Program of nested if
 Void main()
 {
 In a,b,c;
 Cout<<“enter first valuen”;
 Cin>>a;
 Cout<<“enter the 2nd valuen”;
 Cin>>b;
 Cout<<“enter the 3rd valuen”
 Cin>>c;
 If(a==b)
 {
 If(a==c)
 Cout<<“these values are equaln”;
 }
 else
 cout<<“these value are differents”;
What is switch Statement ?
 Switch statement is use when a multiple choice are given
and one choice be selected.
 When the switch statement is executed the given
expression is first evaluate and then value returned by
the expression is compared with the values of the
constant given in each case if the value match with co-
 nstant value of a case then the statement of that case are
execute
 Keyword default is also used in the body of the switch if
no case matched then the statement default are execute
 Break statement
 Break statement is used to exit from the body of the
switch
example of switch in Real life ?
 Let a company allows you a family tour, but the budget is
not confirmed yet so, you would pre-plan the tour ? For
this based on number of family member ready for this
tour ,you would collect information for the tour expense
of different destination and later on, select which one
suits to your budget
What is syntax of switch Statement ?
 Switch(expression)
 {
 Case constant-1;
 Statements;
 Break;
 Case const-2;
 Statements;
 Break;
 Case const-3;
 Statements;
 Default
 Statements;
 }
Program of switch statement?
What is Loop?
Example of Loop in real life?
Intruduction conditional statement
Intruduction conditional statement

More Related Content

PDF
Python Programming - Control Flow
PPTX
The Switch Statement in java
PDF
10. switch case
PPT
If-else and switch-case
PPTX
Presentation on C Switch Case Statements
PPTX
Switch Case in C Program
PPTX
Switch case in C++
PPTX
What is Switch Case?
Python Programming - Control Flow
The Switch Statement in java
10. switch case
If-else and switch-case
Presentation on C Switch Case Statements
Switch Case in C Program
Switch case in C++
What is Switch Case?

What's hot (15)

PPTX
Using decision statements
PPTX
Flow of control by deepak lakhlan
PPTX
IMPROPER INTEGRAL
PDF
nuts and bolts of c++
PPTX
Switch statement, break statement, go to statement
PPT
Lesson 19 improper intergals
DOCX
Normalization
PDF
Database normalization
PDF
Linear regression interpretation
PPT
Flow of Control
PPT
Control statements and functions in c
PPTX
Conditional Statements - R.D.Sivakumar
PPTX
Basic Calculus Lesson 1
PPTX
Midterm 3 review
PPTX
Cse lecture-6-c control statement
Using decision statements
Flow of control by deepak lakhlan
IMPROPER INTEGRAL
nuts and bolts of c++
Switch statement, break statement, go to statement
Lesson 19 improper intergals
Normalization
Database normalization
Linear regression interpretation
Flow of Control
Control statements and functions in c
Conditional Statements - R.D.Sivakumar
Basic Calculus Lesson 1
Midterm 3 review
Cse lecture-6-c control statement
Ad

Viewers also liked (11)

PPTX
Assembly jmp presentation
PPT
Assignment on alp
PPTX
Conditional and biconditional statements
PPTX
Geometric Proofs
DOC
Jumping statements
PPTX
Geometric Proofs
PPT
Conditional Statements
PPT
1st Test - If then, converse, inverse and contrapositive
PPSX
Conditional statement
PPT
Conditionals
PPT
Conditional statements dkjfoafoiej
Assembly jmp presentation
Assignment on alp
Conditional and biconditional statements
Geometric Proofs
Jumping statements
Geometric Proofs
Conditional Statements
1st Test - If then, converse, inverse and contrapositive
Conditional statement
Conditionals
Conditional statements dkjfoafoiej
Ad

Similar to Intruduction conditional statement (20)

PPTX
6 Control Structures-1.pptxAAAAAAAAAAAAAAAAAAAAA
PPT
Decision Making and Branching in C
PPTX
control-statements in C Language MH.pptx
PPTX
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
PPT
C statements.ppt presentation in c language
PPTX
Basics of Control Statement in C Languages
PPT
Decision making and branching
DOCX
Chapter 4(1)
PDF
if else.pdf
PPTX
POLITEKNIK MALAYSIA
PDF
Decision Making Statements, Arrays, Strings
PPTX
Introduction to Selection control structures in C++
PPTX
Do While Repetition Structure
PDF
Unit 2=Decision Control & Looping Statements.pdf
DOCX
C Control Statements.docx
PPT
control-statements detailed presentation
PPT
Unit III Control Flow fundamentals of programming .ppt
PPT
control-statements....ppt - definition
6 Control Structures-1.pptxAAAAAAAAAAAAAAAAAAAAA
Decision Making and Branching in C
control-statements in C Language MH.pptx
Lec-5-IF-ELSE-SWITCH Programming Fundamentals.pptx
C statements.ppt presentation in c language
Basics of Control Statement in C Languages
Decision making and branching
Chapter 4(1)
if else.pdf
POLITEKNIK MALAYSIA
Decision Making Statements, Arrays, Strings
Introduction to Selection control structures in C++
Do While Repetition Structure
Unit 2=Decision Control & Looping Statements.pdf
C Control Statements.docx
control-statements detailed presentation
Unit III Control Flow fundamentals of programming .ppt
control-statements....ppt - definition

Recently uploaded (20)

PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
assetexplorer- product-overview - presentation
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Custom Software Development Services.pptx.pptx
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
assetexplorer- product-overview - presentation
Designing Intelligence for the Shop Floor.pdf
Weekly report ppt - harsh dattuprasad patel.pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Salesforce Agentforce AI Implementation.pdf
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
"Secure File Sharing Solutions on AWS".pptx
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Computer Software and OS of computer science of grade 11.pptx
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
wealthsignaloriginal-com-DS-text-... (1).pdf
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Advanced SystemCare Ultimate Crack + Portable (2025)
Custom Software Development Services.pptx.pptx
Why Generative AI is the Future of Content, Code & Creativity?

Intruduction conditional statement

  • 1. conditional Statement Presented by : khwajaaghakarimy77@gmail.com
  • 3. The topic we’ll present >>> What conditional statements ? What is Types conditional statements? If statements with example If else statement with example Nested if with example Switch Loop
  • 4.  What is conditional?  The conditional statement are used to execute the or (ignore) a set of statement after testing the a condition  The condition statement are also called selection statement
  • 5.  Usage of conditional statement in life ?  I am learning c, c++ I am confuse how it work in real life  In programming each function have a reason  Lets say about conditional statement  A user going to signing up for Facebook bout we don't want the users signing up of age less than 15 years old. If user age is less than 15 it should terminate the sign up page and give a reason saying  “sorry your too Young”  Here we use if else statement behind situation
  • 6. If statement ?  If statement is used to execute or ignore a set of statement after testing the condition  Syntax  if(condition)  Statement -1;  Statement -2;
  • 7. Program of If Statement?
  • 9. Program of If-else statement??
  • 10. If –else statement example in real life??  If it id raining I shall not water the plants , else I have to water the plants.  now we can write it in pseudo code  If (raining == true)  Do not water  Else  Do water
  • 11. Nested if statement Nested if When an if statement is used within another if statement it is called nested statement. If the condition-1 is true then the control shift to the next if statement and the condition-2 is tested If the condition-2 is true then the statement-2 is execute The control will pass to statement -3 and this statement will execute If the condition-2 is false thestatement-2 is skipped and the control shift to the statement-3 and it will execute. Syntax: If (condition-1) { If (condition-2) { statement-2 } Conditon-3
  • 12. Example of nested if in real life If a boy age is more the 18 if his nationality was Afghan than he can give the vote in election now we change it in pseudo code if (age>18) { if (nationality ==‘Afghan’) cout<<“you Can Give the Voten”; } else Cout<<“you can not give the vote”;
  • 13. Program of nested if  Void main()  {  In a,b,c;  Cout<<“enter first valuen”;  Cin>>a;  Cout<<“enter the 2nd valuen”;  Cin>>b;  Cout<<“enter the 3rd valuen”  Cin>>c;  If(a==b)  {  If(a==c)  Cout<<“these values are equaln”;  }  else  cout<<“these value are differents”;
  • 14. What is switch Statement ?  Switch statement is use when a multiple choice are given and one choice be selected.  When the switch statement is executed the given expression is first evaluate and then value returned by the expression is compared with the values of the constant given in each case if the value match with co-  nstant value of a case then the statement of that case are execute  Keyword default is also used in the body of the switch if no case matched then the statement default are execute  Break statement  Break statement is used to exit from the body of the switch
  • 15. example of switch in Real life ?  Let a company allows you a family tour, but the budget is not confirmed yet so, you would pre-plan the tour ? For this based on number of family member ready for this tour ,you would collect information for the tour expense of different destination and later on, select which one suits to your budget
  • 16. What is syntax of switch Statement ?  Switch(expression)  {  Case constant-1;  Statements;  Break;  Case const-2;  Statements;  Break;  Case const-3;  Statements;  Default  Statements;  }
  • 17. Program of switch statement?
  • 19. Example of Loop in real life?