Friday, September 25, 2020

US Money Exchange Solver Using C Language

 I will show you write a program that takes as input any change expressed in cents. It should then compute the number of half-dollars, quarters, dimes, nickels, and pennies to be returned, returning as many half dollars as possible, the quarters, dimes, nickels, and pennies, in that order. For example, 493 cents should return 9 half dollars, 1 quarter, and 1 dime, and 1 nickel and 3 pennies using C programming language.

Note: US half dollar = 50 cents, quarter = 25 cents, dime = 10 cents, nickel = 5 cents, and penny = 1 cent.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking and Arduino Project development at a very affordable price.


Program Listing

 /* us_dollar.c

   Author  : Jake Rodriguez Pomperada, MAED-IT, MIT

   Date    : September 25, 2020    Friday

   Email   : jakerpomperada@gmail.com
   
   Place   : Bacolod City, Negros Occidental, Philippines

   Website : www.jakerpomperada.com / www.jakerpomperada.blogspot.com

*/


#include <stdio.h>

int main()

{

int us_dollar=0;

int halfDollar=0, quarter=0;

int dime=0, penny=0,nickel=0;


printf("\n\n");

printf("\tUS Money Exchange Solver Using C Language");

printf("\n\n");

printf("\tGive amount in US Dollar Cents: ");

scanf("%d",&us_dollar);


halfDollar=us_dollar/50;

us_dollar=us_dollar%50;


quarter=us_dollar/25;

us_dollar=us_dollar%25;


dime=us_dollar/10;

us_dollar=us_dollar%10;

      nickel= us_dollar/5;

penny= us_dollar%5;

printf("\n\n");
   
printf("\tDisplay Results");

printf("\n\n");

printf("\tHalf Dollars : %d\n ",halfDollar);

printf("\tQuarters     : %d\n " ,quarter);

printf("\tDime         : %d\n " ,dime);

printf("\tNickle       : %d\n " ,nickel);

printf("\tPennys       : %d\n " ,penny);

printf("\n\n");

printf("\tEnd of Program");

printf("\n\n");

}



No comments:

Post a Comment