#include <stdio.h>

//*************************************************************
// Function: euroJarTotal
//
// Purpose:
//   Calculates the total value (in euros) of a jar containing
//   euro coins, organized from the smallest denomination to
//   the largest.
//
// Parameters (in ascending coin value):
//   oneCent    - number of 1‑cent coins
//   twoCent    - number of 2‑cent coins
//   fiveCent   - number of 5‑cent coins
//   tenCent    - number of 10‑cent coins
//   twentyCent - number of 20‑cent coins
//   fiftyCent  - number of 50‑cent coins
//   oneEuro    - number of 1‑euro coins
//   twoEuro    - number of 2‑euro coins
//
// Returns:
//   Total value in euros as a double.
//*************************************************************

double euroJarTotal(int oneCent, int twoCent,
                    int fiveCent, int tenCent,
                    int twentyCent, int fiftyCent,
                    int oneEuro, int twoEuro)
{
    double total = 0.0;   // running total of all coin values

    // Add value of 1‑cent coins (0.01 each)
    total += oneCent * 0.01;

    // Add value of 2‑cent coins (0.02 each)
    total += twoCent * 0.02;

    // Add value of 5‑cent coins (0.05 each)
    total += fiveCent * 0.05;

    // Add value of 10‑cent coins (0.10 each)
    total += tenCent * 0.10;

    // Add value of 20‑cent coins (0.20 each)
    total += twentyCent * 0.20;

    // Add value of 50‑cent coins (0.50 each)
    total += fiftyCent * 0.50;

    // Add value of 1‑euro coins (1.00 each)
    total += oneEuro * 1.00;

    // Add value of 2‑euro coins (2.00 each)
    total += twoEuro * 2.00;

    return total;  // return the final euro amount
}

int main(void)
{
    int oneCent, twoCent, fiveCent, tenCent;
    int twentyCent, fiftyCent, oneEuro, twoEuro;

    printf("Enter number of 1-cent coins:\n");
    scanf("%d", &oneCent);

    printf("\nEnter number of 2-cent coins:\n");
    scanf("%d", &twoCent);

    printf("\nEnter number of 5-cent coins:\n");
    scanf("%d", &fiveCent);

    printf("\nEnter number of 10-cent coins:\n");
    scanf("%d", &tenCent);

    printf("\nEnter number of 20-cent coins:\n");
    scanf("%d", &twentyCent);

    printf("\nEnter number of 50-cent coins:\n");
    scanf("%d", &fiftyCent);

    printf("\nEnter number of 1-euro coins:\n");
    scanf("%d", &oneEuro);

    printf("\nEnter number of 2-euro coins:\n");
    scanf("%d", &twoEuro);

    // Call the function with values in smallest → largest order
    double total = euroJarTotal(oneCent, twoCent,
                                fiveCent, tenCent,
                                twentyCent, fiftyCent,
                                oneEuro, twoEuro);

    printf("\nTotal value in the jar: %.2f Euros\n", total);

    return 0;
}
