SlideShare una empresa de Scribd logo
1 de 19
A 
PRESENTATION ON 
CONDITIONAL 
STATEMENT IN “C” 
LANGUAGE
C0NTENT 
1. INTRODUCTION 
2. IF CONDITION 
3. IF ELSE CONDITION 
4. NESTED IF ELSE CONDITION 
5. LADDER ELSE IF CONDITION 
6. SWITCH CASE CONDITION 
7. BREAK STATEMENT 
8. GOTO LABEL STATEMENT 
9. CONTINUE STATEMENT
INTRODUCTION 
Conditional Statements Are Used To Execute A 
Set Of Statements On Some Conditions. It 
Provides A Unit Of Block In Which We Can 
Either One Statement Or More Than One 
Statments. If The Given Condition Is True Then 
The Set Of Statements Are Executed Otherwise 
Body Is Skipped.
IF CONDITION 
It is conditional statement, which is used to 
execute a set of statement on some conditions. 
The condition must be of Boolean type 
expression. 
An expression, which returns only two value 
either TRUE or FALSE, is known as Boolean 
type expression.
Syntax: - if (condition) 
{ 
……………….. 
……………….. 
} 
Include <stdio.h> 
Include<conio.h> 
Void main() 
{ 
Int age; 
Clrscr(); 
If(age>18) 
{ 
Printf(he is eligiable for voting); 
} 
getch(); 
} 
In Another Words, It Can Also Be Said As Single 
Blocked Conditional Statements In Which Only One 
Part Is Mentioned. That Is Known As TRUE Part.
IF ELSE CONDITION 
It Is Known As Double Blocked Conditional 
Statements .It Means, It Has TRUE Parts As 
Well As FALSE Part. 
If The Given Condition Is True Then The 
True Part Is Executed Otherwise False Part Is 
Executed.
Q: -WAP to accept a number and cheak whether he is eligible for voting or not. 
Syntax: - 
if (condition) 
{ 
……………….. 
……………….. 
} 
else 
{ 
……………….. 
……………….. 
} 
Include <stdio.h> 
Include<conio.h> 
Void main() 
{ 
Int age; 
Clrscr(); 
If(age>18) 
{ 
Printf(he is eligiable for voting); 
} 
else 
{ 
Printf(he is not eligiable for 
voting); 
} 
getch(); 
}
NESTED IF ELSE 
Using Of One If Statement Within Another If Statement 
Is Known As Nested Of If else Statement. 
syntax-if 
(……….) 
} 
{ 
else 
…………. 
{ 
…………. 
………… 
if (………) 
………… 
{ 
} 
………….. 
…………..
Q: - WAP to input two numbers and print the gretest numbers. 
Include <stdio.h> 
Include<conio.h> 
Void main() 
{ 
Int a,b; 
Clrscr(); 
If(a==b) 
{ 
Printf(“a is equal to b”); 
} 
else 
If(a>b) 
{ 
Printf(“a is greater”); 
} 
else 
{ 
Printf(“b is greater”); 
} 
getch(); 
}
LADDER ELSE IF CONDITION 
When We Want To Specify Condition With Else 
Part Then We Have To Use Ladder Of If 
Statement. In This Case If The Condition 
Specified With First If -Statement Is False, Then 
Control Goes To Second ―Else If‖ Statement. If It 
Is True Then Part (2) Is Executed Otherwise 
Control Goes To Third ―Else-if‖ Statement. If It 
Is True, Then Part (3) Is Executed Otherwise Part 
(4) Is Executed. 
If The Condition Specified With First If Statement 
Is True, Then Part (1) Is Executed.
Syntax: - 
if (……….) 
{ 
…………. 
…………. 1 
} 
else if (…….) 
{ 
………… 
………… 2 
} 
else if (………) 
{ 
…………. 
…………. 3 
} 
else 
{ 
…………. 
…………. 4
Q: - WAP to input three number and print the greatest number. 
Include <stdio.h> 
Include<conio.h> 
Void main() 
{ 
Int a,b,c; 
Clrscr(); 
printf ("n enter first number: -"); 
scanf("%d",&a); 
printf("n enter secend number : -"); 
scanf("%d",&b); 
printf("n enter third number : -"); 
scanf("%d",&c); 
if(a>b) 
{ 
if(a>c) 
{ 
printf("n a is greatest: -"); 
} 
else 
{ 
printf("n c is greatest: -"); 
} 
} 
else 
if(b>c) 
{ 
printf("n b is greatest: -"); 
} 
else 
{ 
printf("n c is greatest: -"); 
} 
getch(); 
}
SWITCH CASE CONDITION 
It Is Multiple Conditioned Checking 
Statements, Which Is Generally Used For 
Menu- Driven Program Where We Have To 
Select One Option Out Of Several Options At 
A Time. 
The number of ―case within switch – 
statement is same as the number of options 
present in menu. Each ―case is used to do 
only one work at a time.
Default section: - 
It is optional section, which is generally used 
for error handling. It means by using this 
section we can displays error messages. In 
case of wrong choice entry or out of range 
choice. It is automatically executed when any 
user enters wrong choice.
Q: - WAP to accept day no. (1 to 7) and print the day name 
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int a; 
clrscr(); 
printf("enter day numbern****************"); 
scanf("%d",&a); 
switch(a) 
{ 
case 1: 
printf("monday"); 
break; 
case 2: 
printf("tuesday"); 
break; 
case 3: 
printf("wednesday"); 
break; 
case 4: 
printf("thirsday"); 
break; 
case 5: 
printf("friday"); 
break; 
case 6: 
printf("saturday"); 
break; 
case 7: 
printf("sunday"); 
break; 
default: 
printf("day not 
vailedn**************"); 
} 
getch(); 
}
GOTO LABELCONDITION 
This statement is used to send the control 
from one position to any desired position 
within a program. 
Since program is executed from top to bottom 
statement by statement. So if we want to 
execute certain part of program directly, then 
we can use this statement to do the same 
work.
Label: - 
May Be Any User Defined Name Or Identifiers. It Is 
Just Like A Variable But Not A Variable. It Should Not 
Be Declared As Variables By Any Data Type. 
Label Must Be Indicated At That Place Where We 
Want To Send The Control And It Must Be Followed 
By Colon (:) Sign. 
When It Is Directly Used In A Program Then It Just 
Works As Infinite Loop. So It Must Be Used On Some 
Condition.
Syn: - 
goto label; 
Ex: - 
void main () 
{ 
ram: 
----- 
------ 
------- 
--------- 
goto ram; 
---------- 
---------- 
--------- 
}
CONDITIONAL STATEMENT IN C LANGUAGE

Más contenido relacionado

La actualidad más candente

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements Tarun Sharma
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01Wingston
 
Switch Case in C Programming
Switch Case in C ProgrammingSwitch Case in C Programming
Switch Case in C ProgrammingSonya Akter Rupa
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programmingArchana Gopinath
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming LanguageMahantesh Devoor
 
Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder Vishvesh Jasani
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C pptMANJUTRIPATHI7
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__elseeShikshak
 
Presentation on C Switch Case Statements
Presentation on C Switch Case StatementsPresentation on C Switch Case Statements
Presentation on C Switch Case StatementsDipesh Pandey
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programmingPriyansh Thakar
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control StructureSokngim Sa
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++Nitin Jawla
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C v_jk
 

La actualidad más candente (20)

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Switch Case in C Programming
Switch Case in C ProgrammingSwitch Case in C Programming
Switch Case in C Programming
 
If statements in c programming
If statements in c programmingIf statements in c programming
If statements in c programming
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
Presentation on C Switch Case Statements
Presentation on C Switch Case StatementsPresentation on C Switch Case Statements
Presentation on C Switch Case Statements
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
 
Unit 3. Input and Output
Unit 3. Input and OutputUnit 3. Input and Output
Unit 3. Input and Output
 
The Loops
The LoopsThe Loops
The Loops
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Control structures in c++
Control structures in c++Control structures in c++
Control structures in c++
 
Control statements
Control statementsControl statements
Control statements
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 

Similar a CONDITIONAL STATEMENT IN C LANGUAGE

exp227-jan-170127160848 (3) (1).pdf
exp227-jan-170127160848 (3) (1).pdfexp227-jan-170127160848 (3) (1).pdf
exp227-jan-170127160848 (3) (1).pdfmounikanarra3
 
BHARGAVISTATEMENTS.PPT.pptx
BHARGAVISTATEMENTS.PPT.pptxBHARGAVISTATEMENTS.PPT.pptx
BHARGAVISTATEMENTS.PPT.pptxSasideepa
 
CONTROLSTRUCTURES.ppt
CONTROLSTRUCTURES.pptCONTROLSTRUCTURES.ppt
CONTROLSTRUCTURES.pptSanjjaayyy
 
Branching statements
Branching statementsBranching statements
Branching statementsArunMK17
 
unit 2-Control Structures.pptx
unit 2-Control Structures.pptxunit 2-Control Structures.pptx
unit 2-Control Structures.pptxishaparte4
 
Control structuresin c
Control structuresin cControl structuresin c
Control structuresin cVikash Dhal
 
Control statements-Computer programming
Control statements-Computer programmingControl statements-Computer programming
Control statements-Computer programmingnmahi96
 
Conditional statements
Conditional statementsConditional statements
Conditional statementsNabishaAK
 
computer programming Control Statements.pptx
computer programming Control Statements.pptxcomputer programming Control Statements.pptx
computer programming Control Statements.pptxeaglesniper008
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branchingSaranya saran
 
Loop's definition and practical code in C programming
Loop's definition and  practical code in C programming Loop's definition and  practical code in C programming
Loop's definition and practical code in C programming DharmaKumariBhandari
 
CONTROL FLOW in C.pptx
CONTROL FLOW in C.pptxCONTROL FLOW in C.pptx
CONTROL FLOW in C.pptxSmitaAparadh
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in Csana shaikh
 
Control structure of c
Control structure of cControl structure of c
Control structure of cKomal Kotak
 
LET US C (5th EDITION) CHAPTER 4 ANSWERS
LET US C (5th EDITION) CHAPTER 4 ANSWERSLET US C (5th EDITION) CHAPTER 4 ANSWERS
LET US C (5th EDITION) CHAPTER 4 ANSWERSKavyaSharma65
 

Similar a CONDITIONAL STATEMENT IN C LANGUAGE (20)

exp227-jan-170127160848 (3) (1).pdf
exp227-jan-170127160848 (3) (1).pdfexp227-jan-170127160848 (3) (1).pdf
exp227-jan-170127160848 (3) (1).pdf
 
BHARGAVISTATEMENTS.PPT.pptx
BHARGAVISTATEMENTS.PPT.pptxBHARGAVISTATEMENTS.PPT.pptx
BHARGAVISTATEMENTS.PPT.pptx
 
CONTROLSTRUCTURES.ppt
CONTROLSTRUCTURES.pptCONTROLSTRUCTURES.ppt
CONTROLSTRUCTURES.ppt
 
Branching statements
Branching statementsBranching statements
Branching statements
 
unit 2-Control Structures.pptx
unit 2-Control Structures.pptxunit 2-Control Structures.pptx
unit 2-Control Structures.pptx
 
Control structuresin c
Control structuresin cControl structuresin c
Control structuresin c
 
Control statements-Computer programming
Control statements-Computer programmingControl statements-Computer programming
Control statements-Computer programming
 
C Unit-2.ppt
C Unit-2.pptC Unit-2.ppt
C Unit-2.ppt
 
Decision Making and Branching
Decision Making and BranchingDecision Making and Branching
Decision Making and Branching
 
Conditional statements
Conditional statementsConditional statements
Conditional statements
 
computer programming Control Statements.pptx
computer programming Control Statements.pptxcomputer programming Control Statements.pptx
computer programming Control Statements.pptx
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
3. control statement
3. control statement3. control statement
3. control statement
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
Loop's definition and practical code in C programming
Loop's definition and  practical code in C programming Loop's definition and  practical code in C programming
Loop's definition and practical code in C programming
 
CONTROL FLOW in C.pptx
CONTROL FLOW in C.pptxCONTROL FLOW in C.pptx
CONTROL FLOW in C.pptx
 
C++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdfC++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdf
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
LET US C (5th EDITION) CHAPTER 4 ANSWERS
LET US C (5th EDITION) CHAPTER 4 ANSWERSLET US C (5th EDITION) CHAPTER 4 ANSWERS
LET US C (5th EDITION) CHAPTER 4 ANSWERS
 

Último

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Último (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

CONDITIONAL STATEMENT IN C LANGUAGE

  • 1. A PRESENTATION ON CONDITIONAL STATEMENT IN “C” LANGUAGE
  • 2. C0NTENT 1. INTRODUCTION 2. IF CONDITION 3. IF ELSE CONDITION 4. NESTED IF ELSE CONDITION 5. LADDER ELSE IF CONDITION 6. SWITCH CASE CONDITION 7. BREAK STATEMENT 8. GOTO LABEL STATEMENT 9. CONTINUE STATEMENT
  • 3. INTRODUCTION Conditional Statements Are Used To Execute A Set Of Statements On Some Conditions. It Provides A Unit Of Block In Which We Can Either One Statement Or More Than One Statments. If The Given Condition Is True Then The Set Of Statements Are Executed Otherwise Body Is Skipped.
  • 4. IF CONDITION It is conditional statement, which is used to execute a set of statement on some conditions. The condition must be of Boolean type expression. An expression, which returns only two value either TRUE or FALSE, is known as Boolean type expression.
  • 5. Syntax: - if (condition) { ……………….. ……………….. } Include <stdio.h> Include<conio.h> Void main() { Int age; Clrscr(); If(age>18) { Printf(he is eligiable for voting); } getch(); } In Another Words, It Can Also Be Said As Single Blocked Conditional Statements In Which Only One Part Is Mentioned. That Is Known As TRUE Part.
  • 6. IF ELSE CONDITION It Is Known As Double Blocked Conditional Statements .It Means, It Has TRUE Parts As Well As FALSE Part. If The Given Condition Is True Then The True Part Is Executed Otherwise False Part Is Executed.
  • 7. Q: -WAP to accept a number and cheak whether he is eligible for voting or not. Syntax: - if (condition) { ……………….. ……………….. } else { ……………….. ……………….. } Include <stdio.h> Include<conio.h> Void main() { Int age; Clrscr(); If(age>18) { Printf(he is eligiable for voting); } else { Printf(he is not eligiable for voting); } getch(); }
  • 8. NESTED IF ELSE Using Of One If Statement Within Another If Statement Is Known As Nested Of If else Statement. syntax-if (……….) } { else …………. { …………. ………… if (………) ………… { } ………….. …………..
  • 9. Q: - WAP to input two numbers and print the gretest numbers. Include <stdio.h> Include<conio.h> Void main() { Int a,b; Clrscr(); If(a==b) { Printf(“a is equal to b”); } else If(a>b) { Printf(“a is greater”); } else { Printf(“b is greater”); } getch(); }
  • 10. LADDER ELSE IF CONDITION When We Want To Specify Condition With Else Part Then We Have To Use Ladder Of If Statement. In This Case If The Condition Specified With First If -Statement Is False, Then Control Goes To Second ―Else If‖ Statement. If It Is True Then Part (2) Is Executed Otherwise Control Goes To Third ―Else-if‖ Statement. If It Is True, Then Part (3) Is Executed Otherwise Part (4) Is Executed. If The Condition Specified With First If Statement Is True, Then Part (1) Is Executed.
  • 11. Syntax: - if (……….) { …………. …………. 1 } else if (…….) { ………… ………… 2 } else if (………) { …………. …………. 3 } else { …………. …………. 4
  • 12. Q: - WAP to input three number and print the greatest number. Include <stdio.h> Include<conio.h> Void main() { Int a,b,c; Clrscr(); printf ("n enter first number: -"); scanf("%d",&a); printf("n enter secend number : -"); scanf("%d",&b); printf("n enter third number : -"); scanf("%d",&c); if(a>b) { if(a>c) { printf("n a is greatest: -"); } else { printf("n c is greatest: -"); } } else if(b>c) { printf("n b is greatest: -"); } else { printf("n c is greatest: -"); } getch(); }
  • 13. SWITCH CASE CONDITION It Is Multiple Conditioned Checking Statements, Which Is Generally Used For Menu- Driven Program Where We Have To Select One Option Out Of Several Options At A Time. The number of ―case within switch – statement is same as the number of options present in menu. Each ―case is used to do only one work at a time.
  • 14. Default section: - It is optional section, which is generally used for error handling. It means by using this section we can displays error messages. In case of wrong choice entry or out of range choice. It is automatically executed when any user enters wrong choice.
  • 15. Q: - WAP to accept day no. (1 to 7) and print the day name #include<stdio.h> #include<conio.h> void main() { int a; clrscr(); printf("enter day numbern****************"); scanf("%d",&a); switch(a) { case 1: printf("monday"); break; case 2: printf("tuesday"); break; case 3: printf("wednesday"); break; case 4: printf("thirsday"); break; case 5: printf("friday"); break; case 6: printf("saturday"); break; case 7: printf("sunday"); break; default: printf("day not vailedn**************"); } getch(); }
  • 16. GOTO LABELCONDITION This statement is used to send the control from one position to any desired position within a program. Since program is executed from top to bottom statement by statement. So if we want to execute certain part of program directly, then we can use this statement to do the same work.
  • 17. Label: - May Be Any User Defined Name Or Identifiers. It Is Just Like A Variable But Not A Variable. It Should Not Be Declared As Variables By Any Data Type. Label Must Be Indicated At That Place Where We Want To Send The Control And It Must Be Followed By Colon (:) Sign. When It Is Directly Used In A Program Then It Just Works As Infinite Loop. So It Must Be Used On Some Condition.
  • 18. Syn: - goto label; Ex: - void main () { ram: ----- ------ ------- --------- goto ram; ---------- ---------- --------- }