Question: Q 1 . [ 2 0 ] For Q 1 , write a small program to solve the problem. Your programs must include the function

Q1.[20] For Q1, write a small program to solve the problem. Your programs must include the function prototype,
function call, and function definition. Submit a screenshot of the code and screenshots of the output using
several cases. You do not need the analysis and algorithm for this part. You must also upload your .c files.
a. Define a function PrintFeetInchShort (), with int parameters numFeet and numInches, that prints the
dimensions using the ' and "shorthand. The user will enter the values for feet and inches in main() and the
PrintFeetInchShort () will be called. For example, if numFeet is 5 and numInches is 8, the function prints
5'8". Hint: Use " in the printf() to print a double quote.
b. Write a function PrintPopcornTime() which prints the time in seconds needed to pop a bad of popcorn.
The user enters the size of the bag in ounces (int bagounces) in main() and calls the function. In the
function, if bagounces is less than 3, print "Too small". If greater than 10, print "Too large". Otherwise,
compute and print the seconds needed to pop the bag where seconds =6** bagounces.
c. Define a function PyramidVolume() with float data type parameters baseLength, baseWidth, and
pyramidHeight, that returns as a float the volume of a pyramid with a rectangular base. The user enters
the values for length, width, and height in main() using scanf(); the volume is calculated in the function
but printed in main(). Relevant geometry equations:
Volume = base area x height 13
Base area = base length x base width.
(Watch out for integer division).
Q2.[10] For Q2, write a small program to solve the problem. Your program must include the function prototype,
function call, and function definition. Submit a screenshot of the code and screenshots of the output using
several cases. You also need the analysis and algorithm for this part. In this case there will be an algorithm for the
main program and a separate algorithm for the function.
Write a program to calculate the temperature inside the earth at a certain depth. In main() the user is asked
for depth within the earth. The user will call a function temp_depth() which would calculate the
temperature at the depth in Celsius and Fahrenheit using the formulas below. Both temperatures will be
calculated in the function but will be printed in main().
The temperature in Celsius at a given depth (km) is calculated as:
Celsius =(10** depth )+20
Convert to Fahrenheit using the following:
Fahrenheit =(1.8** Celsius )+32
 Q1.[20] For Q1, write a small program to solve the problem.

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!