Advertisement
kurec

Untitled

Oct 4th, 2020
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Bankomat
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             decimal amount = decimal.Parse(Console.ReadLine());
  10.             int m = 0;
  11.  
  12.             m += Convert.ToInt32(Math.Truncate(amount / 100));
  13.             amount = amount % 100;
  14.             m += Convert.ToInt32(Math.Truncate(amount / 50));
  15.             amount = amount % 50;
  16.             m += Convert.ToInt32(Math.Truncate(amount / 20));
  17.             amount = amount % 20;
  18.             m += Convert.ToInt32(Math.Truncate(amount / 10));
  19.             amount = amount % 10;
  20.             m += Convert.ToInt32(Math.Truncate(amount / 5));
  21.             amount = amount % 5;
  22.             m += Convert.ToInt32(Math.Truncate(amount / 2));
  23.             amount = amount % 2;
  24.             m += Convert.ToInt32(Math.Truncate(amount / 1));
  25.             amount = amount % 1;
  26.            
  27.             Console.WriteLine(m);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement