/* evalcoins.c Coin conversion. Compute pennies and nickels converted to dollars and change. ** Student name goes here ** */ #include int main(void) { /* Data fields */ int pennies; /* input - the number of pennies */ int nickels; /* input - the number of nickels */ int total; /* the calculated total worth (in cents) */ int dollars; /* the dollar portion of the total */ int change; /* the change portion of the total */ /* Obtain input amounts */ printf("How many pennies: "); scanf("%d", &pennies); printf("How many nickels: "); scanf("%d", &nickels); /* Calculate the total amount in cents */ total = 5 * nickels + pennies; /* Calculate the dollar portion */ dollars = total / 100; /* Calculate the change portion*/ change = total % 100; /* Display results */ printf("Dollars: %d\n", dollars); printf("Change: %d\n", change); printf("Worth: $%d.%2d\n", dollars,change); return 0; }