The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Make a change simulator using simple integer division in C language. Example; for $5, how many quarters would that be? the program must be able to count a total number of coins for dimes, nickels, and pennies as well. So i would be looking for  an output of 20 quarters, 50 dimes, 100 nickels, 500 pennies. I have some code written but i can't seem to get it to work.
Â
#include <stdio.h>int main(void){printf("enter a dollar amount between 1 and 99\n");int x;int y;scanf("%d" , &x);x=y*100;int pennies = y / 1;y=y%1;printf("%d Number of Pennies\n" , pennies );int nickels = y / 5;y=y%5;printf("%d Number of Nickels\n" , nickels );int dimes = y / 10;y=y%10;printf("%d Number of Dimes\n" , dimes );int quarters = y / 25;y=y%25;printf("%d Number of Quarters\n" , quarters );}
-----------