Decision Making statements in C Programming

Decision-Making statements in C Programming


In this tutorial, we will study decision-making statements in c, the if statement, else statement, and the if-else statement.

What are the decision-making statements?


Decision Making can be understood by using an example, the age of the student is stored in two-variables but if we want to print the age of the student we can use the decision-making statements (if, if-else, else if, Switch) in this situation.

What are if statements?


The If statement uses the curly braces { } for defining the block. If the condition is true then the statement inside the block is executed. And if the condition is false then the compiler skips the statements inside the block. The if statement can be used as many times as we want to.
if(condition)
{
/* Statements */
}

What are the if-else statements?


It is similar to the if statement but in this, the else block is added and the else is executed when the condition in the if is false. The If-Else Statement defines right and wrong. Just like the if statement it can be used as many times as we
if(condition)
{
/* Statements1*/
}
else
{
/* Statements2*/
}

What are the else statements?


If in the if and else we want to add a new condition then we have to define the else if block. Unlike the if and if-else statement, we can not use it else as many times as we want to. There can be only one else statement for each if the statements.
if (condition)
{
/* Statements1*/
}
else if (condition)
{
/* Statements2*/
}
else (condition)
{
/* Statements3*/
}

What is the switch statement?


The switch statement is similar to the if statement but in the switch statement we check the case. In the switch case, a variable is tested for equality against a list of values. On reaching a particular condition only the statements are executed which are written inside the case. The Case is matched with the integer variable. If the case integer variable is matched then the case is executed.
switch (expression)
{
case constant: statement1;
break;
case constant: statement2;
break;
case constant: statement3;
break;
default: statement;
break;
}

 

7 decision-making process steps


Though there are many slight variations of the decision-making framework floating around on the Internet, in business textbooks, and in leadership presentations, professionals most commonly use these seven steps.



1. Identify the decision


To make a decision, you must first identify the problem you need to solve or the question you need to answer. Clearly define your decision. If you misidentify the problem to solve, or if the problem you’ve chosen is too broad, you’ll knock the decision train off the track before it even leaves the station.


If you need to achieve a specific goal from your decision, make it measurable and timely so you know for certain that you met the goal at the end of the process.



2. Gather relevant information


Once you have identified your decision, it’s time to gather the information relevant to that choice. Do an internal assessment, seeing where your organization has succeeded and failed in areas related to your decision. Also, seek information from external sources, including studies, market research, and, in some cases, evaluation from paid consultants.


Beware: you can easily become bogged down by too much information—facts and statistics that seem applicable to your situation might only complicate the process.



3. Identify the alternatives


With relevant information now at your fingertips, identify possible solutions to your problem. There is usually more than one option to consider when trying to meet a goal—for example, if your company is trying to gain more engagement on social media, your alternatives could include paid social advertisements, a change in your organic social media strategy, or a combination of the two.



4. Weigh the evidence


Once you have identified multiple alternatives, weigh the evidence for or against said alternatives. See what companies have done in the past to succeed in these areas, and take a good hard look at your own organization’s wins and losses. Identify potential pitfalls for each of your alternatives, and weigh those against the possible rewards.



5. Choose among alternatives


Here is the part of the decision-making process where you, you know, make the decision. Hopefully, you’ve identified and clarified what decision needs to be made, gathered all relevant information, and developed and considered the potential paths to take. You are perfectly prepared to choose.



6. Take action


Once you’ve made your decision, act on it! Develop a plan to make your decision tangible and achievable. Develop a project plan related to your decision, and then set the team loose on their tasks once the plan is in place.



7. Review your decision


After a predetermined amount of time—which you defined in step one of the decision-making process—take an honest look back at your decision. Did you solve the problem? Did you answer the question? Did you meet your goals?


If so, take note of what worked for future reference. If not, learn from your mistakes as you begin the decision-making process again.


Also read:

WordPress Firefox Plugins for Developers and Bloggers for 2021

Insurance AI startup synthesized increases $2.8M from IQ Capital and Mundi Ventures.

How to optimizations by Angular in 2021?

 

 

Comments

Popular posts from this blog

How to create a blog in PHP and MySQL database - DB design

Secure React SPA using Keycloak with OpenID Connect in 2021

All About Software Architecture for 2021 Developers