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 change = double.Parse(Console.ReadLine());
- double stotinki = change * 100;
- int countOfCoins = 0;
- while (stotinki > 0)
- {
- if (stotinki >= 200)
- {
- countOfCoins++;
- stotinki -= 200;
- }
- else if (stotinki >= 100)
- {
- countOfCoins++;
- stotinki -= 100;
- }
- else if (stotinki >= 50)
- {
- countOfCoins++;
- stotinki -= 50;
- }
- else if (stotinki >= 20)
- {
- countOfCoins++;
- stotinki -= 20;
- }
- else if (stotinki >= 10)
- {
- countOfCoins++;
- stotinki -= 10;
- }
- else if (stotinki >= 5)
- {
- countOfCoins++;
- stotinki -= 5;
- }
- else if (stotinki >= 2)
- {
- countOfCoins++;
- stotinki -= 2;
- }
- else if (stotinki >= 1)
- {
- countOfCoins++;
- stotinki -= 1;
- }
- else
- {
- break;
- }
- }
- Console.WriteLine(countOfCoins);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment