Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Coins
- {
- class Program
- {
- static void Main(string[] args)
- {
- double change = double.Parse(Console.ReadLine());
- int numberCoins = 0;
- int coins = 0;
- change *= 100;
- coins = (int)change / 200;
- change -= coins * 200;
- numberCoins += coins;
- coins = (int)change / 100;
- change -= coins * 100;
- numberCoins += coins;
- coins = (int)change / 50;
- change -= coins * 50;
- numberCoins += coins;
- coins = (int)change / 20;
- change -= coins * 20;
- numberCoins += coins;
- coins = (int)change / 10;
- change -= coins * 10;
- numberCoins += coins;
- coins = (int)change / 5;
- change -= coins * 5;
- numberCoins += coins;
- coins = (int)change / 2;
- change -= coins * 2;
- numberCoins += coins;
- coins = (int)change / 1;
- change -= coins * 1;
- numberCoins += coins;
- Console.WriteLine(numberCoins);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment