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 Money = double .Parse(Console.ReadLine());
- double Resto = Money * 100;
- double countCoint = 0;
- while(Resto>0)
- {
- if(Resto>=200)
- {
- countCoint = Math.Truncate(Resto / 200);
- Resto = Resto % 200;
- }
- else if (Resto >= 100 && Resto < 200)
- {
- countCoint += Math.Truncate(Resto / 100);
- Resto = Resto % 100;
- }
- else if (Resto >= 50 && Resto < 100)
- {
- countCoint += Math.Truncate(Resto /50);
- Resto = Resto % 50;
- }
- else if (Resto >= 20 && Resto < 50)
- {
- countCoint += Math.Truncate(Resto / 20);
- Resto = Resto % 20;
- }
- else if (Resto >= 10 && Resto < 20)
- {
- countCoint += Math.Truncate(Resto / 10);
- Resto = Resto % 10;
- }
- else if (Resto >= 5 && Resto < 10)
- {
- countCoint += Math.Truncate(Resto / 5);
- Resto = Resto % 5;
- }
- else if (Resto >= 2 && Resto < 5)
- {
- countCoint += Math.Truncate(Resto / 2);
- Resto = Resto % 2;
- }
- else if (Resto == 1)
- {
- countCoint++;
- break;
- }
- }
- Console.WriteLine(countCoint);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment