Advertisement
vvsvvs

Untitled

Apr 1st, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Coins
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. double inputValue;
  11. int counter, resultValue, i, a, n;
  12. bool isLoopExit;
  13.  
  14.  
  15. inputValue = double.Parse(Console.ReadLine());
  16. counter = i = a = n = 0;
  17. isLoopExit = false;
  18. inputValue *= 100;
  19. resultValue = (int) inputValue;
  20.  
  21. for (i = 1; i <= 8; i++)
  22. {
  23. switch (i)
  24. {
  25. case 1:
  26. a = 200;
  27. break;
  28. case 2:
  29. a = 100;
  30. break;
  31. case 3:
  32. a = 50;
  33. break;
  34. case 4:
  35. a = 20;
  36. break;
  37. case 5:
  38. a = 10;
  39. break;
  40. case 6:
  41. a = 5;
  42. break;
  43. case 7:
  44. a = 2;
  45. break;
  46. case 8:
  47. a = 1;
  48. break;
  49. }
  50.  
  51. n = resultValue / a;
  52. resultValue -= n * a;
  53. counter += n;
  54. }
  55.  
  56.  
  57. Console.WriteLine(counter);
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement