Please type the answer for i can copy it. Thank you very much.
-Question
Describe decision processing control structures. Provide a unique scenario that requires the use of decision processing to solve a business problem.
/*
Author - Ripul Vohra
Do give me thumbs up.
*/
Decision Processing Control Structures are the structures that define control the flow of a program. The decision is made on the basis of some condition and this condition is responsible for controlling the flow of the progrom. There are various types of control structures : Branch, Loop and Jump.
A. The branch instruction contains :
1. if, if else - else cannot occur without if. They occur with a pair. if can occur without else.
Example program to check if number is less than or greater than or equal to 5 .
#include<stdio.h>
int main(){
int a; scanf("%d",&a);
if(a>5) printf("a is greater than 5");
else if(a==5) printf("a is equal to 5");
else printf(a is smaller than 5");
return 0;
}
2. switch - switch is used to send the control of program to a particular according to the parameter passing in it .
Example program to check if number is equal to 5 or not.
#include<stdio.h>
int main(){
int a; scanf("%d",&a);
switch(a)
{
case 5 : a is equal to 5; break;
default : a is not equal to 5;
}
return 0;
}
B. Loop structures : These are required if some piece of code needs to repeated.
1. for loop : for loop has three parts - initialistion, condition check and increment/decrement.
Example program to print numbers from 1 to 100.
#include<stdio.h>
int main(){
for(int i=1;i<=100;i++)
{
printf("%d ",i);
}
return 0;
}
2. while loop - while loop contains a condition check. All the instructions inside the loop will keep on executing until the condition is true.As soon as the conditions returns false, program exits from loop.
Example Program to print number from 1 to 100 :
#include<stdio.h>
int main(){
int i=1;
while(i<=100)
{
printf("%d ",i);
i++;
}
return 0;
}
3. do-while loop - do while loop is similar to while loop except the do part which will always be executed irrespective of condition being true or false.
Example Problem
#include<stdio.h>
int main(){
int i=0;
do
{
printf("Hello\n");
}while(i<0)
return 0;
}
Output will be - Hello
C. Jumping Instructions : These are required to jump to a particular piece of code in the whole program. These include:
1. break - break command is used to come out of looping instructions.
Example program to print all the numbers from 1 to 100
#include<stdio.h>
int main(){
int i=1;
while(true)
{
if(i>100) break;
printf("%d ",i);
i++;
}
return 0;
}
2. continue - continue is used to skip a particular piece of code that is under the continue condition and sends the control flow back to loop parameters.
Example Program to print numbers from 1 to 100 except 37
#include<stdio.h>
int main(){
for(int i=1;i<=100;i++)
{
if(i==37) continue;
printf("%d ",i);
}
return 0;
}
Use of Control Structues in Business Problem :
Business Problem : Suppose, a company Amnesia has launched a hair oil and is selling this hair oil in various parts of India. Now, they have recieved a profit sheet in form of an array. Array tells them profit numbers in various cities. Now,according to them, if profit earned by product is more than 30%,then it will be continued for that particular city. Otherwise,they are gonna stop selling their product in that city. And in some cities,profit will be more than 50%. So they are gonna increase their sales for those cities. Now,they want you to write a program to tell number of cities in which sales needs to stopped and number of cities for which sales need to be increased.
Input Data of 20 cities -
12,89,63,74,34,56,32,45,65,11,54,34,67,23,27,76,24,53,77,61
Use of control statements in the program -
#include <stdio.h>
int main()
{
int
sales[20]={12,89,63,74,34,56,32,45,65,11,54,34,67,23,27,76,24,53,77,61};
int cities_stop=0;
int cities_increase=0;
for(int i=0;i<20;i++)
{
if(sales[i]<30) cities_stop++;
else if(sales[i]<=50) continue;
else cities_increase++;
}
printf("No of Cities for which sales need to be stopped =
%d\n",cities_stop);
printf("No of Cities for which sales need to be increased =
%d",cities_increase);
}
OUTPUT-
No of Cities for which sales need to be stopped = 5 No of Cities for which sales need to be increased = 11
So, for loop(looping), if else(branching ) and continue(jumping) all of these control stuctures were used in this business problem.
Please type the answer for i can copy it. Thank you very much. -Question Describe decision...
please answer as soon as possible. thank you. Please write 400+ words. Thank you very much. what can you as students do to help to slow or solve climate change?
I am struggling very much with this question, could you please provide a detailed answer, I will rate it. Thank you very much. |(a) Differentiate the following functions with respect to and simplify your answer 1. possible far as as -5 1 mark (ii) esin (2r [4 marks 11 y = In(a) [5 marks (b) Determine the following da : sin (i) 6 marks dx 11 - 1)(x +3) |(a) Differentiate the following functions with respect to and simplify your...
pl please answer part 2 and 3 of this question thank you very much Question 2 (20 pts). In the DSC experiments, we measure the phase transition temperature of lipid bilayers formed by different types of lipids. Given the chemical structures of the following lipids: ?? ? DPPC ??? POPC ??? DMPC ?-?-? ??? DOPC
Can you please help me to answer this question. Thank you very much. Learning Outcome 5e -ADAS model QUESTION 4 2 MARKS Discuss four measures and explain their transmission channels (how do the measures work in practice) that can be adopted to increase Aggregate Demand (8 marks), and discuss two measures and explain their transmission channels that can be adopted to increase Aggregate Supply (4 marks)
*Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Health Illness * Help me, Answer all Questions, and I need more details and more Explain ____________ Q) How can socioeconomic level affect health ? please give examples of health problem to elaborate your answer. (i need 300 words) Thank You..
*Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Health Illness * Help me, Answer all Questions, and I need more details and more Explain ____________ Q) How can socioeconomic level affect health ? please give examples of health problem to elaborate your answer. (i need 300 words) Thank You..
Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. * i need References URL Link please help me to answer this question , i need it quickly Q : Describe the trend of mortality in Saudi Arabia due to any one health phenomena and suggest any 2 measures to control it - Example maternal mortality, perinatal mortality, accident mortality, mortality due to any type of cancer etc. ( i need more than...
Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. * i need References URL Link please help me to answer this question , i need it quickly Q : Describe the trend of mortality in Saudi Arabia due to any one health phenomena and suggest any 2 measures to control it - Example maternal mortality, perinatal mortality, accident mortality, mortality due to any type of cancer etc. ( i need more than...
Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. * i need References URL Link please help me to answer this question , i need it quickly Q : Describe the trend of mortality in Saudi Arabia due to any one health phenomena and suggest any 2 measures to control it - Example maternal mortality, perinatal mortality, accident mortality, mortality due to any type of cancer etc. ( i need more than...
Please answer this question according to the instruction, Thank you so much! 6. (16 pt) Use arrow pushing to provide a reasonable mechanism for the following transformation. Use resonance structures OCH3 CH3OH/HCI(cat) ??