Question: Please write this program and explain what each line of code is doing in the program. this needs to be in basic C programming Write

Please write this program and explain what each line of code is doing in the program. this needs to be in basic C programming

Write a program that includes a function picnic() that will accept a floating-point number total and the addresses of the integer variables hotdogs, hamburgers, salad, pickles. The passed floating-point number represents the total amount of money to be spent on food. The function is to determine the quantity of hotdogs, hamburgers, salad, and pickles that can be purchased, writing these values directly into the respective variables declared in the calling function.

This function will be called from the main program and when it returns to main, it will print out the values of hotdogs, hamburgers, salad, and pickles.

Our favorite foods are in this order:

hot dogs--$1.00 each

hamburgers--$0.50 each

salad--$0.25 each

pickles--$0.01 each

For example, if I enter a total amount of money of $3.78, I can bring the following items to my picnic:

3 hot dogs

1 hamburger

1 salad

3 pickles

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!