SlideShare a Scribd company logo
1 of 20
Operators and conditional statements in C
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 1
Learning Hub
Erode 638 011
Mob:93600 48588
chandkec@gmail.co
m
ACE Learning Hub
Erode 638 011
Mob:93600 48588
chandkec@gmail.com
Operators:
• An operator is a symbol that tells the compiler to perform a certain
mathematical or logical manipulation.
• Operators are used in programs to manipulate data and variables.
The various types of operators:
1) Arithmetic operators (+, -, *, /, %)
2) Assignment operators (=)
3) Relational /Comparison operators (>, =, <=, ==,!=)
4) Increment and Decrement operators (++, - -)
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 3
(i)Arithmetic operators:
An arithmetic operator performs mathematical operations such as
addition, subtraction, multiplication, division etc on numerical values
(constants and variables).
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 4
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 5
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 6
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 7
(iv) Relational or comparison operators:
• Relational operators are used to compare values of two expressions.
Relational operators are binary operators because they require two
operands to operate.
• An expression which contains the relational operators is called
relational expression.
• If the relation is true then the result of the relational expression is
1, if the relation is false then the result of the relational expression
is 0.
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 8
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 9
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 10
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 11
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 12
Conditional statements in C:
(i) Simple IF statement:
• It contains only the true statement and its condition.
• The statements inside the body of “if” only execute if the given
condition returns true.
• If the condition returns false then the statements inside “if” are
skipped
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 13
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 14
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 15
(ii) IF..Else statements :
• It contains both the true and false statements along with its condition.
IF condition returns true then the statements inside the body of “IF”
are executed and the statements inside body of “else” are skipped.
• IF condition returns false then the statements inside the body of “IF”
are skipped and the statements in “else” are executed.
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 16
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 17
• In this program user is asked to enter the age and based on the input, the
if..else statement checks whether the entered age is greater than or
equal to 18.
• If this condition is met, then display message “You are eligible for
voting”, however if the condition isn’t met, then display a different
message “You are not eligible for voting”.
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 18
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 19
28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 20

More Related Content

Similar to Operators and Conditional statements in C

2 Program Design Methodology
2 Program Design Methodology2 Program Design Methodology
2 Program Design MethodologyKwan Lee
 
1Z0-061 Oracle Database 12c: SQL Fundamentals
1Z0-061 Oracle Database 12c: SQL Fundamentals1Z0-061 Oracle Database 12c: SQL Fundamentals
1Z0-061 Oracle Database 12c: SQL FundamentalsLydi00147
 
chap 2 : Operators and Assignments (scjp/ocjp)
chap 2 : Operators and Assignments (scjp/ocjp)chap 2 : Operators and Assignments (scjp/ocjp)
chap 2 : Operators and Assignments (scjp/ocjp)It Academy
 
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docx
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docxSTAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docx
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docxsusanschei
 
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfgratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfNarReg
 
Application driven graph partitioning - SIGMOD'20
Application driven graph partitioning - SIGMOD'20Application driven graph partitioning - SIGMOD'20
Application driven graph partitioning - SIGMOD'20Hadi Sinaee
 

Similar to Operators and Conditional statements in C (8)

Programming note C#
Programming note C#Programming note C#
Programming note C#
 
2 Program Design Methodology
2 Program Design Methodology2 Program Design Methodology
2 Program Design Methodology
 
1Z0-061 Oracle Database 12c: SQL Fundamentals
1Z0-061 Oracle Database 12c: SQL Fundamentals1Z0-061 Oracle Database 12c: SQL Fundamentals
1Z0-061 Oracle Database 12c: SQL Fundamentals
 
chap 2 : Operators and Assignments (scjp/ocjp)
chap 2 : Operators and Assignments (scjp/ocjp)chap 2 : Operators and Assignments (scjp/ocjp)
chap 2 : Operators and Assignments (scjp/ocjp)
 
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docx
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docxSTAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docx
STAT 200 Final ExaminationFall 2019 OL1Page 1 of 11Answer .docx
 
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdfgratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
gratisexam.com-Oracle.BrainDumps.1z0-061.v2016-10-10.by.Laura.75q.pdf
 
Application driven graph partitioning - SIGMOD'20
Application driven graph partitioning - SIGMOD'20Application driven graph partitioning - SIGMOD'20
Application driven graph partitioning - SIGMOD'20
 
Relational Algebra1.pptx
Relational Algebra1.pptxRelational Algebra1.pptx
Relational Algebra1.pptx
 

More from chandkec

Class 8 Science :Conservation of plants and animals
Class 8 Science :Conservation of plants and animalsClass 8 Science :Conservation of plants and animals
Class 8 Science :Conservation of plants and animalschandkec
 
Industries
IndustriesIndustries
Industrieschandkec
 
Theoritical concept of operating system
Theoritical concept of operating systemTheoritical concept of operating system
Theoritical concept of operating systemchandkec
 
Computer organisation ppt
Computer organisation pptComputer organisation ppt
Computer organisation pptchandkec
 
Do we need a parliament ?
Do we need a parliament ?Do we need a parliament ?
Do we need a parliament ?chandkec
 
Ch 6. combustion and flame
Ch 6. combustion and flameCh 6. combustion and flame
Ch 6. combustion and flamechandkec
 
8th standard, Geography :Ch 4. Agriculture
8th standard, Geography :Ch 4. Agriculture8th standard, Geography :Ch 4. Agriculture
8th standard, Geography :Ch 4. Agriculturechandkec
 
8th Standard Geography : Rocks and Soils
8th Standard Geography : Rocks and Soils8th Standard Geography : Rocks and Soils
8th Standard Geography : Rocks and Soilschandkec
 
Introduction to Turbo C data types
Introduction to Turbo  C data typesIntroduction to Turbo  C data types
Introduction to Turbo C data typeschandkec
 
Computer science introduction to C programming
Computer science introduction to C programmingComputer science introduction to C programming
Computer science introduction to C programmingchandkec
 
8th computer science ch 1
8th computer science ch 18th computer science ch 1
8th computer science ch 1chandkec
 
8th Standard, Geography: Rocks and soils 8th and soil
8th Standard, Geography: Rocks and soils 8th and soil8th Standard, Geography: Rocks and soils 8th and soil
8th Standard, Geography: Rocks and soils 8th and soilchandkec
 
Ch 6. square and squareroots
Ch 6. square and squarerootsCh 6. square and squareroots
Ch 6. square and squarerootschandkec
 
Ch 6. square and squareroots
Ch 6. square and squarerootsCh 6. square and squareroots
Ch 6. square and squarerootschandkec
 
Ch 18. pollution
Ch 18. pollutionCh 18. pollution
Ch 18. pollutionchandkec
 
NCERT_Class 8Geography 3.minerals and power resources
NCERT_Class 8Geography 3.minerals and power resourcesNCERT_Class 8Geography 3.minerals and power resources
NCERT_Class 8Geography 3.minerals and power resourceschandkec
 
Microorganism : uses
Microorganism : usesMicroorganism : uses
Microorganism : useschandkec
 
Laws of exponents and Power
Laws of exponents and PowerLaws of exponents and Power
Laws of exponents and Powerchandkec
 
Exponents and powers--Part1
Exponents and powers--Part1Exponents and powers--Part1
Exponents and powers--Part1chandkec
 
CBSE Class 8_Exponents and powers+part1
CBSE Class 8_Exponents and powers+part1CBSE Class 8_Exponents and powers+part1
CBSE Class 8_Exponents and powers+part1chandkec
 

More from chandkec (20)

Class 8 Science :Conservation of plants and animals
Class 8 Science :Conservation of plants and animalsClass 8 Science :Conservation of plants and animals
Class 8 Science :Conservation of plants and animals
 
Industries
IndustriesIndustries
Industries
 
Theoritical concept of operating system
Theoritical concept of operating systemTheoritical concept of operating system
Theoritical concept of operating system
 
Computer organisation ppt
Computer organisation pptComputer organisation ppt
Computer organisation ppt
 
Do we need a parliament ?
Do we need a parliament ?Do we need a parliament ?
Do we need a parliament ?
 
Ch 6. combustion and flame
Ch 6. combustion and flameCh 6. combustion and flame
Ch 6. combustion and flame
 
8th standard, Geography :Ch 4. Agriculture
8th standard, Geography :Ch 4. Agriculture8th standard, Geography :Ch 4. Agriculture
8th standard, Geography :Ch 4. Agriculture
 
8th Standard Geography : Rocks and Soils
8th Standard Geography : Rocks and Soils8th Standard Geography : Rocks and Soils
8th Standard Geography : Rocks and Soils
 
Introduction to Turbo C data types
Introduction to Turbo  C data typesIntroduction to Turbo  C data types
Introduction to Turbo C data types
 
Computer science introduction to C programming
Computer science introduction to C programmingComputer science introduction to C programming
Computer science introduction to C programming
 
8th computer science ch 1
8th computer science ch 18th computer science ch 1
8th computer science ch 1
 
8th Standard, Geography: Rocks and soils 8th and soil
8th Standard, Geography: Rocks and soils 8th and soil8th Standard, Geography: Rocks and soils 8th and soil
8th Standard, Geography: Rocks and soils 8th and soil
 
Ch 6. square and squareroots
Ch 6. square and squarerootsCh 6. square and squareroots
Ch 6. square and squareroots
 
Ch 6. square and squareroots
Ch 6. square and squarerootsCh 6. square and squareroots
Ch 6. square and squareroots
 
Ch 18. pollution
Ch 18. pollutionCh 18. pollution
Ch 18. pollution
 
NCERT_Class 8Geography 3.minerals and power resources
NCERT_Class 8Geography 3.minerals and power resourcesNCERT_Class 8Geography 3.minerals and power resources
NCERT_Class 8Geography 3.minerals and power resources
 
Microorganism : uses
Microorganism : usesMicroorganism : uses
Microorganism : uses
 
Laws of exponents and Power
Laws of exponents and PowerLaws of exponents and Power
Laws of exponents and Power
 
Exponents and powers--Part1
Exponents and powers--Part1Exponents and powers--Part1
Exponents and powers--Part1
 
CBSE Class 8_Exponents and powers+part1
CBSE Class 8_Exponents and powers+part1CBSE Class 8_Exponents and powers+part1
CBSE Class 8_Exponents and powers+part1
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
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
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
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...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Operators and Conditional statements in C

  • 1. Operators and conditional statements in C 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 1 Learning Hub Erode 638 011 Mob:93600 48588 chandkec@gmail.co m
  • 2. ACE Learning Hub Erode 638 011 Mob:93600 48588 chandkec@gmail.com
  • 3. Operators: • An operator is a symbol that tells the compiler to perform a certain mathematical or logical manipulation. • Operators are used in programs to manipulate data and variables. The various types of operators: 1) Arithmetic operators (+, -, *, /, %) 2) Assignment operators (=) 3) Relational /Comparison operators (>, =, <=, ==,!=) 4) Increment and Decrement operators (++, - -) 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 3
  • 4. (i)Arithmetic operators: An arithmetic operator performs mathematical operations such as addition, subtraction, multiplication, division etc on numerical values (constants and variables). 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 4
  • 5. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 5
  • 6. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 6
  • 7. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 7
  • 8. (iv) Relational or comparison operators: • Relational operators are used to compare values of two expressions. Relational operators are binary operators because they require two operands to operate. • An expression which contains the relational operators is called relational expression. • If the relation is true then the result of the relational expression is 1, if the relation is false then the result of the relational expression is 0. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 8
  • 9. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 9
  • 10. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 10
  • 11. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 11
  • 12. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 12 Conditional statements in C: (i) Simple IF statement: • It contains only the true statement and its condition. • The statements inside the body of “if” only execute if the given condition returns true. • If the condition returns false then the statements inside “if” are skipped
  • 13. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 13
  • 14. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 14
  • 15. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 15 (ii) IF..Else statements : • It contains both the true and false statements along with its condition. IF condition returns true then the statements inside the body of “IF” are executed and the statements inside body of “else” are skipped. • IF condition returns false then the statements inside the body of “IF” are skipped and the statements in “else” are executed.
  • 16. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 16
  • 17. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 17 • In this program user is asked to enter the age and based on the input, the if..else statement checks whether the entered age is greater than or equal to 18. • If this condition is met, then display message “You are eligible for voting”, however if the condition isn’t met, then display a different message “You are not eligible for voting”.
  • 18. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 18
  • 19. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 19
  • 20. 28/9/2021 A.Chandran ACE Learning Hub, chandkec#gmail.com 20