Question: Program C homework 1. Making a decision between two alternative courses of action is usually implemented with a(n) ________ statement in C. 2. Trace the

Program C homework

1. Making a decision between two alternative courses of action is usually implemented with a(n) ________ statement in C.

2. Trace the following program fragment; indicate which function will be called if a data value of 27.34 is entered.

printf("Enter a temperature> ");

scanf("%lf", &temp);

if (temp > 32.0)not_freezing();

elseice_forming();

3. Write a multiple-alternative if statement to display a message indicating the educational level of a student based on the students number of years of schooling (0, none; 15, elementary school; 68, middle school; 912, high school; more than 12, college). Print a message to indicate bad data as well.

4. Write a switch statement to select an operation based on the value of inventory . Increment total_paper by paper_order if inventory is 'B' or 'C' ; increment total_ribbon by ribbon_order if inventory is 'E' , 'F' , or 'D' ; increment total_label by label_order if inventory is 'A' or 'X' . Do nothing if inventory is 'M' . Display an error message if the value of inventory is not one of these eight letters.

5. Write an if statement that displays an acceptance message for an astronaut candidate if the persons weight is between the values of opt_min and opt_max.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!