Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int clients = int.Parse(Console.ReadLine());
- double sum = 0.0;
- for (int i = 0; i < clients; i++)
- {
- double price = 0.0;
- int item = 0;
- string command = Console.ReadLine();
- while (command != "Finish")
- {
- if (command == "basket")
- {
- price += 1.50;
- item++;
- }
- if (command == "wreath")
- {
- price += 3.80;
- item++;
- }
- if (command == "chocolate bunny")
- {
- price += 7.0;
- item++;
- }
- command = Console.ReadLine();
- }
- if (item % 2 == 0)
- {
- price *= 0.80;
- }
- Console.WriteLine($"You purchased {item} items for {price:F2} leva.");
- sum += price;
- }
- double average = sum / clients;
- Console.WriteLine($"Average bill per client is: {average:f2} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement