Guest User

eminem4pog2

a guest
Nov 22nd, 2019
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication25
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {//prochitame broq dni pochivka na desi
  13. int days = int.Parse(Console.ReadLine());
  14.  
  15. double budget = 0.0;
  16.  
  17. //vurtim cikul kolkoto dni imame
  18. for (int i = 0; i < days; i++)
  19. {
  20. budget += 60;
  21. int products = 0;
  22.  
  23. while (true)
  24. {
  25. string command = Console.ReadLine();
  26. if (command == "Day over")
  27. {
  28. Console.WriteLine("Money left from today: {0}. You've bought {1} products.", budget.ToString("0.00"), products);
  29.  
  30.  
  31. //prikluchvame denq
  32. break;
  33.  
  34. }
  35.  
  36. double productPrice = double.Parse(command);
  37.  
  38. if (budget - productPrice < 0)
  39. {
  40. Console.WriteLine("Daily limit exceeded!You've bought {0} products.", products);
  41. //krai kogato nqma pari
  42. break;
  43. }
  44. else if (budget - productPrice == 0)
  45. {
  46. products += 1;
  47. Console.WriteLine("Daily limit exceeded!You've bought {0} products.", products);
  48. //krai kogato nqma pari
  49. break;
  50.  
  51. }
  52. else
  53. {
  54. //parite dostigatm, premahvame ot budgeta i dobavqne na tavana u koshnicata
  55.  
  56. budget -= productPrice;
  57. products += 1;
  58.  
  59.  
  60.  
  61. }
  62.  
  63. }
  64.  
  65.  
  66. }
  67.  
  68.  
  69. }
  70.  
  71. }
  72. }
RAW Paste Data