Decision Making In C programming
In C programming if we want to execute different statements for different conditions then we can use decision making statements.Decision making statements evaluate different conditions and then execute different statements based on the result.We write our condition such that it gives us a boolean result ie true or false if condition is true then some set of instructions is executed and if the condition is false then we can perform some other task.Thus decision making statements help program in taking decision.
A simple block diagram is shown below used in most f the decision making statements-
Syntax of if statement
Types of Decision Making statements in C programming Language
Here are some different types of Decision making statements used in C programming language-if Statement |
if else statement |
nested if statements |
switch statement |
nested switch statements |
if statement
If statement consist a conditional statement which returns a boolean value ie true or false and it is followed by a set of statements which we want to execute if the condition is true.Syntax of if statement
if(conditional expression){ statement or set of statements to be executed if the conditional expression gives a true value }
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment