Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Coins
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] coins = { 200, 100, 50, 20, 10, 5, 2, 1 };
- double price = double.Parse(Console.ReadLine());
- price *= 100;
- price = Math.Round(price, 0);
- int counter = 0;
- int i = 0;
- while(price > 0)
- {
- if (price >= coins[i])
- {
- price -= coins[i];
- if (price >= coins[i])
- i--;
- counter++;
- }
- i++;
- }
- Console.WriteLine(counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement