// Assignment Final Question 2
//
// Name: <Maribel Fuentes>
//
// Class: C Programming, <Fall 2024>
//
// Date: <December 2, 2024>
#include <stdio.h>
double calculateJarAmount(int dollars, int halfDollars, int quarters, int dimes, int nickels, int pennies) {
return dollars * 1.0 + halfDollars * 0.5 + quarters * 0.25 + dimes * 0.1 + nickels * 0.05 + pennies * 0.01;
}
int main() {
int dollars = 0, halfDollars = 11, quarters = 7, dimes = 3, nickels = 12, pennies = 17;
double totalAmount = calculateJarAmount(dollars, halfDollars, quarters, dimes, nickels, pennies);
printf("Total amount in the jar: $%.2f\n", totalAmount);
return 0;
}
Ly8gQXNzaWdubWVudCBGaW5hbCBRdWVzdGlvbiAyCi8vCi8vIE5hbWU6IDxNYXJpYmVsIEZ1ZW50ZXM+Ci8vCi8vIENsYXNzOiBDIFByb2dyYW1taW5nLCA8RmFsbCAyMDI0PgovLwovLyBEYXRlOiA8RGVjZW1iZXIgMiwgMjAyND4KCgojaW5jbHVkZSA8c3RkaW8uaD4KCmRvdWJsZSBjYWxjdWxhdGVKYXJBbW91bnQoaW50IGRvbGxhcnMsIGludCBoYWxmRG9sbGFycywgaW50IHF1YXJ0ZXJzLCBpbnQgZGltZXMsIGludCBuaWNrZWxzLCBpbnQgcGVubmllcykgewogICAgcmV0dXJuIGRvbGxhcnMgKiAxLjAgKyBoYWxmRG9sbGFycyAqIDAuNSArIHF1YXJ0ZXJzICogMC4yNSArIGRpbWVzICogMC4xICsgbmlja2VscyAqIDAuMDUgKyBwZW5uaWVzICogMC4wMTsKfQoKaW50IG1haW4oKSB7CiAgICBpbnQgZG9sbGFycyA9IDAsIGhhbGZEb2xsYXJzID0gMTEsIHF1YXJ0ZXJzID0gNywgZGltZXMgPSAzLCBuaWNrZWxzID0gMTIsIHBlbm5pZXMgPSAxNzsKICAgIGRvdWJsZSB0b3RhbEFtb3VudCA9IGNhbGN1bGF0ZUphckFtb3VudChkb2xsYXJzLCBoYWxmRG9sbGFycywgcXVhcnRlcnMsIGRpbWVzLCBuaWNrZWxzLCBwZW5uaWVzKTsKICAgIHByaW50ZigiVG90YWwgYW1vdW50IGluIHRoZSBqYXI6ICQlLjJmXG4iLCB0b3RhbEFtb3VudCk7CiAgICByZXR1cm4gMDsKfQ==