If Statement
It is a simple form of decision making.
It decides whether the statements will be executed or not, i.e., it checks the condition and returns true if the given condition is satisfied.
,
if-else Statement
The if statement only returns the result when the condition is true.
But if we want to returns something when the condition is false, then we need to use the if-else statement.
The if-else statement tests the condition.
If the condition is true, it executes if block and if the condition is false, it executes the else block.
,
if-else-if Ladder
Here a user can take decision among multiple options.
It starts execution in a top-down approach.
When the condition gets true, it executes the associated statement, and the rest of the condition is bypassed.
If it does not find any condition true, it returns the final else statement.
,
What is a decision-making statement in C?
In C, there are three primary decision-making statements that you can use:
- Each of these statements allows you to make decisions in different ways
- depending on the complexity of your code and the specific conditions you need to evaluate
The
if-else statement is C's most fundamental decision-making statement.
,
What makes a good decision-making process?
A good decision-making process gathers enough information before making any moves.
A large number of people groups are involved in decision-making.
The entire group accepts it rather than just a single person.
Every individual expresses their point of view in response to a certain situation.