#include <stdio.h>
int main(void) {
// **************************************************
// Function: money_jar_total
//
// Description: Calculates the total amount of money in a jar cotaining various coins
//
// Parameters: dollars - amount of dollars in jar
// half_dollars - amount of half dollars in jar
// quarters - amount of quarters in jar
// dimes- amount of dimes in jar
// nickles - amount of nickles in jar
// pennies - amount of pennies in jar
//
// Returns: total - Total amount of cash in jar as a double data type
//
// ***************************************************
double money_jar_total(int dollars, int half_dollars, int quarters,
int dimes, int nickles, int pennies)
{
double total =
(dollars * 1.00) +
(half_dollars * 0.50) +
(quarters * 0.25) +
(dimes * 0.10) +
(nickles * 0.05) +
(pennies * 0.01);
return total;
}
double total_amount = money_jar_total(0,11,7,3,12,17);
printf("The total amount in the jar is $%.2f\n", total_amount
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CgkvLyAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoJLy8gRnVuY3Rpb246IG1vbmV5X2phcl90b3RhbAoJLy8KCS8vIERlc2NyaXB0aW9uOiBDYWxjdWxhdGVzIHRoZSB0b3RhbCBhbW91bnQgb2YgbW9uZXkgaW4gYSBqYXIgY290YWluaW5nIHZhcmlvdXMgY29pbnMKCS8vCgkvLyBQYXJhbWV0ZXJzOiBkb2xsYXJzIC0gYW1vdW50IG9mIGRvbGxhcnMgaW4gamFyCgkvLwkJCSAgIGhhbGZfZG9sbGFycyAtIGFtb3VudCBvZiBoYWxmIGRvbGxhcnMgaW4gamFyCgkvLwkJCSAgIHF1YXJ0ZXJzIC0gYW1vdW50IG9mIHF1YXJ0ZXJzIGluIGphcgoJLy8JCQkgICBkaW1lcy0gYW1vdW50IG9mIGRpbWVzIGluIGphcgoJLy8JCQkgICBuaWNrbGVzIC0gYW1vdW50IG9mIG5pY2tsZXMgaW4gamFyCgkvLwkJCSAgIHBlbm5pZXMgLSBhbW91bnQgb2YgcGVubmllcyBpbiBqYXIKCS8vCgkvLyBSZXR1cm5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