anizko

05. Coins

Apr 5th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Coins
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double Money = double.Parse(Console.ReadLine());
  10.             double Resto = Money * 100;
  11.             double countCoint = 0;
  12.  
  13.             while (Resto > 0)
  14.             {
  15.                 if (Resto >= 200)
  16.                 {
  17.                     Resto -= 200;
  18.                 }
  19.                 else if (Resto >= 100)
  20.                 {
  21.                     Resto -= 100;
  22.                 }
  23.                 else if (Resto >= 50)
  24.                 {
  25.                     Resto -=50;
  26.                 }
  27.                 else if (Resto >= 20)
  28.                 {
  29.                     Resto -=20;
  30.                 }
  31.                 else if (Resto >= 10)
  32.                 {
  33.                     Resto -=10;
  34.                 }
  35.                 else if (Resto >= 5)
  36.                 {  
  37.                     Resto -=5;
  38.                 }
  39.                 else if (Resto >= 2)
  40.                 {
  41.                     Resto -=2;
  42.                 }
  43.                 else if (Resto >= 1)
  44.                 {
  45.                     Resto--;
  46.                 }
  47.                 else
  48.                 {
  49.                     break;
  50.                 }
  51.                 countCoint++;
  52.             }
  53.  
  54.             Console.WriteLine(countCoint);
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment