Programs are much more useful if they can make decisions about what tasks need to be performed. Making a decision in a C program usually involves testing the value of one or more variables. Which concept will be used? Explain it with the help of suitable examples.
Answers
Answered by
3
Answer:
In C programming the (if...else statement ), (for loop), (switch case) or (while loop) is suitable to compare more than one variable.
Thank you and please rate me as brainliest as it will help me to level up
Answered by
0
The concept of decision-making statements to determine the flow of a program's execution will be used.
- Making decisions involves choosing the sequence in which statements should be executed based on specific conditions or repeatedly executing a group of statements up until certain predetermined conditions are met. The options for making decisions in C are:
if-else statement, in C:
- A block of statements will be executed if a condition is true, and if it is false, they won't be, according to the if statement alone. But what if the condition is false and we want to take another action? The C else statement is now being used. If the condition is false, we can use the else statement with the if statement to run a block of code.
Conditional Operator:
- The ternary operator is another name for the conditional operator. The decision-making statements that depend on the expression's output are known as conditional statements.
Syntax of a conditional operator
- Expression1? expression2: expression3;
Switch statement:
- In C, the switch statement is an alternative to the if-else-if ladder statement that enables us to perform multiple operations for the various possible values of a single variable called the switch variable. Here, we can define different statements in a variety of situations for various values of a single variable.
To learn more:
https://brainly.in/question/25399054
https://brainly.in/question/5772572
https://brainly.in/question/31342420
#SPJ2
Similar questions