C Online Compiler
Example: C program of decision making by using if-else ladder
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C program of decision making by using if-else ladder #include <stdio.h> int main() { int n; printf("Enter an integer value::\n"); scanf("%d", &n); if (n == 0) { printf("Fisrt condition is true.\n"); } else if (n == 1) { printf("Second condition is true.\n"); } else if (n == 2) { printf("Third condition is true.\n"); } else { printf("Condition failed!\n"); } return 0; }
1
Output
Clear
ADVERTISEMENTS