ATM Money pumping Program using c#

Hi all, The below program is to get the Currency notes count using User Input.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BasicCalculations
{
class Program
{
static void Main(string[] args)
{
//Currecy Exxisting inside Mechine
List<int> lstCurrencies = new List<int>() { 1, 2, 5, 10, 20, 50, 100, 500, 1000, 2000 };
int inputValue = 20041;// User Input
foreach (var currecy in lstCurrencies.OrderByDescending(a => a).ToList())
{
if ((inputValue / currecy) != 0)
Console.Write("your base curency is  " + currecy + ": Expected currecy Count =" + inputValue / currecy + "\n"); // Print Data
inputValue = inputValue % currecy;
if (inputValue == 0)
break; // Break Loop
}
Console.ReadKey();
}
}
}

Comments

Popular posts from this blog

Reverse Sentence using c#

How to write Pure java script Program?