- C Programming Basics
- C Tutorial
- C Program Structure
- C Basic Syntax
- C Data Types
- C Constants
- C Variables
- C Operators
- C Ternary Operator
- C Storage Classes
- C Flow of Control
- C Decision Making
- C if if-else Statement
- C switch Statement
- C Loops
- C for Loop
- C while Loop
- C do-while Loop
- C goto Statement
- C break Statement
- C continue Statement
- C Popular Topics
- C Arrays
- C Strings
- C Pointers
- C Functions
- C Recursion
- C Scope Rules
- C Programming Advance
- C Structures
- C Unions
- C Bit Fields
- C Enumerations
- C Input & Output
- C Typedef
- C Preprocessors
- C Type Casting
- C Recursion
- C Error Handling
- C Linked Lists
- C Stacks
- C Queues
- C Binary Trees
- C Header Files
- C File I/O
- C Variable Arguments
- C Memory Management
- C Command Line Arguments
- C Programming Examples
- C Programming Examples
- C Programming Test
- C Programming Test
C Decision Making
C supports the following two types of decision making statements:
You can further divide both the above statements into the following parts:
C Decision Making Statements Example
Here is an example demonstrates how to use decision making statements in C programming to control the program.
/* C Decision Making Example */ #include<stdio.h> #include<conio.h> void main() { int num; clrscr(); printf("Enter a number: "); scanf("%d", &num); if(num>10) { printf("The number is greater than 10."); } else { printf("The number is less than 10."); } getch(); }
Here are the two sample runs of the above C decision making program:


Let's take another program on decision making or selection statements in C.
/* C Decision Making Program */ #include<stdio.h> #include<conio.h> void main() { int num; clrscr(); printf("Enter 10."); scanf("%d", &num); if(num == 10) printf("Well Done!"); else printf("Oops!"); getch(); }
Here are the two sample runs of the above selection statements program in C.


Here is another example also demonstrates decision making statement in C
/* C Decision Making */ #include<stdio.h> #include<conio.h> void main() { int mark; clrscr(); printf("Enter marks obtained: "); scanf("%d", &mark); if(mark>80) printf("You are passed!"); else printf("You are failed!"); getch(); }
Here are the two sample runs of the above C decision making program:


More Examples
Here are the list of some more examples that you can go for:
- Check Even or Odd
- Check Prime or Not
- Check Alphabet or Not
- Check Vowel or Not
- Check Leap Year or Not
- Check Palindrome or Not
- Check Armstrong or Not
- Linear Search
- Binary Search
- Insert Element in Array
- Delete Element from Array
- Check Anagram or Not
« Previous Tutorial Next Tutorial »
Follow/Like Us on Facebook
Subscribe Us on YouTube