Advertisement
KrasenPenev

bla bal 2

Feb 11th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Tourist_Shop
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double budget = double.Parse(Console.ReadLine());
  14.  
  15. double productCounter = 1;
  16. double sum = 0;
  17. // double sumProduct = 0;
  18. double productPriceCounter=0;
  19.  
  20. string nameProduct = Console.ReadLine();
  21. double priceProduct = double.Parse(Console.ReadLine());
  22. while (nameProduct != "Stop" || priceProduct > budget)
  23. {
  24.  
  25. nameProduct = Console.ReadLine();
  26. priceProduct = double.Parse(Console.ReadLine());
  27. productCounter++;
  28.  
  29. if (productCounter == 3)
  30. {
  31. priceProduct /= 2;
  32. }
  33. productPriceCounter += priceProduct;
  34.  
  35.  
  36. sum = budget - priceProduct; // tva neshto ne mi haresva tuka :D
  37.  
  38.  
  39. }
  40. if (nameProduct=="Stop")
  41. {
  42. Console.WriteLine($"You bought {productCounter} products for {productPriceCounter } leva");
  43. }
  44. if (priceProduct > budget)
  45. {
  46. sum = budget - priceProduct;
  47. }
  48.  
  49.  
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement