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)
- {
- double inputValue;
- int counter, resultValue, i, a, n;
- bool isLoopExit;
- inputValue = double.Parse(Console.ReadLine());
- counter = i = a = n = 0;
- isLoopExit = false;
- inputValue *= 100;
- resultValue = (int) inputValue;
- for (i = 1; i <= 8; i++)
- {
- switch (i)
- {
- case 1:
- a = 200;
- break;
- case 2:
- a = 100;
- break;
- case 3:
- a = 50;
- break;
- case 4:
- a = 20;
- break;
- case 5:
- a = 10;
- break;
- case 6:
- a = 5;
- break;
- case 7:
- a = 2;
- break;
- case 8:
- a = 1;
- break;
- }
- n = resultValue / a;
- resultValue -= n * a;
- counter += n;
- }
- Console.WriteLine(counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement