QP School
if-else statements in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: if-else statements in C (/showthread.php?tid=5079)



if-else statements in C - Qomplainerz - 07-25-2023

Conditional statements allow you to execute different code blocks based on certain conditions.

int num = 10;
if (num > 0) {
    printf("Positive\n");
} else if (num < 0) {
    printf("Negative\n");
} else {
    printf("Zero\n");
}