In: Computer Science
In the space provided below write a C program that computes the total amount of money you have stored in your piggy bank. Your program does this by asking you for number of pennies, nickels, dimes, and quarters in the piggy bank and then displays how much money in total is in the piggy bank.
Source code:
// we we assumed that
// penny= 1 cent , nickel= 5 cents , dime= 10 cents , quarter= 25
cents
#include <stdio.h>
int main()
{
int
no_pennies=0,no_nickels=0,no_dimes=0,no_quarters=0;
int total_money=0;
printf("Enter number of pennies in piggy bank:
");
scanf("%d",&no_pennies);
printf("Enter number of nickels in piggy bank:
");
scanf("%d",&no_nickels);
printf("Enter number of dimes in piggy bank: ");
scanf("%d",&no_dimes);
printf("Enter number of quarters in piggy bank:
");
scanf("%d",&no_quarters);
total_money=(no_pennies*1)+(no_nickels*5)+(no_dimes*10)+(no_quarters*25);
printf("Total money in piggy bank is %d
cents\n",total_money );
}