Computer Science, asked by sdbbhosale, 1 month ago

Write a java program to calculate the sum of money in the form of denominations as - Sample input : - 8785 Sample output :- Rs. 05 : 1 Rs. 10 : 1 Rs. 20 : 1 Rs. 50 : 1 Rs. 100 : 0 Rs. 200 : 2 Rs. 500 :1 Rs. 1000 : 8 Accept the money from the user through the terminal window.​

Answers

Answered by markadhavan1009
0

Answer:

gergbrrgbrgvvtverhhrgndb jhnn

Answered by rdchennai58
0

Explanation:

C++ program to accept an amount

// and count number of notes

#include <bits/stdc++.h>

using namespace std;

// function to count and

// print currency notes

void countCurrency(int amount)

{

int notes[9] = { 2000, 500, 200, 100,

50, 20, 10, 5, 1 };

int noteCounter[9] = { 0 };

// count notes using Greedy approach

for (int i = 0; i < 9; i++) {

if (amount >= notes[i]) {

noteCounter[i] = amount / notes[i];

amount = amount - noteCounter[i] * notes[i];

}

}

// Print notes

cout << "Currency Count ->" << endl;

for (int i = 0; i < 9; i++) {

if (noteCounter[i] != 0) {

cout << notes[i] << " : "

<< noteCounter[i] << endl;

}

}

}

// Driver function

int main()

{

int amount = 868;

countCurrency(amount);

return 0;

Similar questions