Question: Can someone help me with the C practice question?? This is what I was working on so far: #include #include //Function prototype void pay_amount(int dollars,

Can someone help me with the C practice question??

Can someone help me with the C practice question?? This is what

This is what I was working on so far:

#include

#include

//Function prototype

void pay_amount(int dollars, int *twenties, int *tens, int *fives, *int toonies, *int loonies);

int main(void){

int a, b, c, d, e, f;

//Ask user for a dollar amount

printf("Please enter a dollar amount:");

scanf("%d", &a);

//Validate input

if(a

printf("Error: please enter a valid dollar amount.");

return 1;

}

//Call function

//Need to specify ALL ints or just a as a parameter?

pay_amount(a, b, c, d, e, f);

printf("The dollar amount can be made using: %d twenties, %d tens, %d fives, %d toonies, %d loonies.", b, c, d, e, f);

return 0;

}

pay_amount(int dollars, int *twenties, int *tens, int *fives, *int toonies, *int loonies){

}

Thanks!!

Write a C program named change.c that determines the smallest number of $20, $10, $5, $2, and $1 bills/coins necessary to pay a dollar amount. The function prototype must be as follow: void pay amount(int dollars, int *twenties, int *tens, int fives, int *toonies, int lonnies); where the dollar amount is represented by the dollars parameter. The twenties parameter points to a variable in which the function will store the number of $20 bills required. The tens, fives, toonies and lonnies parameters are similar To test your function, write a main function that asks the user to enter a positive integer value (to be validated by your program). Consider this value to be the dollar amount (dollars) and get the smallest number of bills/coins necessary to pay this amount, and then display the values returned by the function If invalid input is entered (not a number or negative) you program should exit with an error message and non-zero exit status, otherwise return an exit status of zero. Test your code and ensure it works correctly with the following values (you do not need to provide this output with your submission): 118, 81, 12, and

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!