Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Tourist_Shop
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- double productCounter = 1;
- double sum = 0;
- // double sumProduct = 0;
- double productPriceCounter=0;
- string nameProduct = Console.ReadLine();
- double priceProduct = double.Parse(Console.ReadLine());
- while (nameProduct != "Stop" || priceProduct > budget)
- {
- nameProduct = Console.ReadLine();
- priceProduct = double.Parse(Console.ReadLine());
- productCounter++;
- if (productCounter == 3)
- {
- priceProduct /= 2;
- }
- productPriceCounter += priceProduct;
- sum = budget - priceProduct; // tva neshto ne mi haresva tuka :D
- }
- if (nameProduct=="Stop")
- {
- Console.WriteLine($"You bought {productCounter} products for {productPriceCounter } leva");
- }
- if (priceProduct > budget)
- {
- sum = budget - priceProduct;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement