Last active
May 13, 2025 12:37
-
-
Save Zodik09/71000b735b9466cfbb51c78941c74929 to your computer and use it in GitHub Desktop.
57. You need to write a program where the user inputs an amount in Indian Rupees, and the program should output the number of currency notes required to make up that amount using the largest denominations first. Denominations Available (Indian Rupees): ₹2000, ₹500, ₹200, ₹100, ₹50, ₹20, ₹10, ₹5, ₹2, ₹1 // Example 1: // Input: // Amount: 4327 // …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prompt = require("prompt-sync")(); | |
let rupees = Number(prompt("Enter the amount: ")); | |
let money = [2000, 500, 200, 100, 50, 20, 10, 5, 2, 1]; | |
for (const note of money) { | |
let count = Math.floor(rupees / note) | |
rupees %= note; | |
console.log(`₹${note} X ${count}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment