Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Cpp program to distribute cash notes
- // created on May, 2016
- // Author: fueanta
- #include <iostream>
- using namespace std;
- int main() {
- int notes[7]={100,50,20,10,5,2,1};
- int quantities[7]={0,0,0,0,0,0,0};
- int cash;
- cout << "Amount of cash?\n" << endl;
- cout << "Tk: ";
- cin >> cash;
- for (int i=0,j=0;cash>=0;i++) {
- j=cash/notes[i];
- if (j>0) {
- quantities[i]=j;
- }
- cash=cash-(notes[i]*j);
- if (cash<1)
- break;
- }
- cout << "\nNotes to be given :\n******************* " << endl;
- for (int i=0;i<7;i++) {
- cout << quantities[i] << " note(s) of Tk: " << notes[i] << ".00" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement