Logo 
Search:

C Programming Forum

Ask Question   UnAnswered
Home » Forum » C Programming       RSS Feeds

C Programmin Help - coin value

  Asked By: Brandon    Date: Aug 30    Category: C Programming    Views: 873
  

I need in writing a program that will calculate the total value of a coin collection. The program will ask the user to type in the number of quarters, dimes, nickels and pennies. It will then convert them to the total value.
For example: 3 quarters and 3 pennies will result to “78 cents”
3 quarters, 5 dimes, and 2 nickels will result to “1 dollars and 35 cents

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Brandon Walston     Answered On: Aug 30

I have this so far in my program.

#include <stdio.h>
void main ()
{
// Local data ...
int pennies; // input: count of pennies
int nickels; // input: count of nickels
int dimes; // input: count of dimes
int quarters; // input: count of quarters
// Read in the count of quarters, dimes, nickels and pennies.
printf("Enter the number of quarters, dimes,
nickels, and pennies: ");
scanf("%d %d %d %d", &quarters, &dimes, &nickels, &pennies);

 
Didn't find what you were looking for? Find more on C Programmin Help - coin value Or get search suggestion and latest updates.




Tagged: