this is sort of like an atm-ish project....
i thought of many possible things i learn't but maybe it still isn't enough...
maybe you can help me finish this program with just basic variables in it.. printf, scanf, and the like...
THE PROBLEM: create a program that will ask an amount in pesos(integer) and determine the lowest # of bills he will need to achieve the amount entered. The bills in use are 1000peso, 500peso, 200peso, 100peso, 50peso, 20peso, 10peso, 5peso, 1peso.
/* peso is a currency XD */
an example would be if i entered an amount of 1898 pesos, it would come up with
you need:
peso1000:1
peso500:1
peso200:1
peso100:1
oeso50:1
peso20:2
peso10:
peso5:1
peso1:3
so far i've made this: i know the nAmnt's in the printf's are wrong but i just don't know what to put.
Code:#include <stdio.h> main() { int nPeso1000, nPeso500, nPeso200, nPeso100, nPeso50, nPeso20, nCoin10, nCoin5, nCoin1, n, nAmnt; printf("Enter Amount:"); scanf("%d", nAmnt); printf("xxxxxxxxx\n"); printf("xxBillsxx\n"); printf("xxxxxxxxx\n\n"); printf("1000:%d\n",nAmnt); printf("500:%d\n", nAmnt); printf("500:%d\n", nAmnt); printf("200:%d\n", nAmnt); printf("100:%d\n", nAmnt); printf("50:%d\n", nAmnt); printf("20:%d\n\n", nAmnt); printf("xxxxxxxxx\n"); printf("xxCoinsxx\n"); printf("xxxxxxxxx\n\n"); printf("10:%d\n", nAmnt); printf("5:%d\n", nAmnt); printf("1:%d\n", nAmnt); getch(); return 0; }



LinkBack URL
About LinkBacks


