C & C++ Programming
Computer ScienceChapter 3 — Conditional Statements and Loops
Lesson 3.1 : if, if-else and Nested if
Reading & Interactive Lesson
if, if-else and Nested if
Reading Material & Notes
Conditional Statements
Conditional statements allow a program to execute different code depending on a condition.
if Statement
if (age >= 18)
{
printf("Adult");
}
if-else Statement
if (marks >= 40)
printf("Pass");
else
printf("Fail");
Nested if
A nested if is an if statement placed inside another if statement.
if (age >= 18)
{
if (citizen == 1)
printf("Eligible");
}
Conditional statements are widely used for decision-making.
Course Curriculum
10 Chapters • 50 Lessons
Chapter 1 — Introduction to C and C++
5 Lessons
Chapter 2 — Variables, Data Types and Operators
5 Lessons
Chapter 3 — Conditional Statements and Loops
5 Lessons
Chapter 4 — Functions and Modular Programming
5 Lessons
Chapter 5 — Arrays and Strings
5 Lessons
Chapter 6 — Pointers and References
5 Lessons
Chapter 7 — Structures, Unions and Enumerations
5 Lessons
Chapter 8 — Object-Oriented Programming in C++
5 Lessons
Chapter 9 — Inheritance, Polymorphism and Templates
5 Lessons
Chapter 10 — File Handling and Mini Projects
5 Lessons