Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ReportSystem
- {
- class Program
- {
- static void Main(string[] args)
- {
- double sum = double.Parse(Console.ReadLine());
- double cash = 0;
- double card = 0;
- int cashC = 0;
- int cardC = 0;
- int counter = 1;
- while (true)
- {
- string count = Console.ReadLine();
- if (count != "End")
- {
- int money = int.Parse(count);
- if ((cash + card) >= sum)
- {
- Console.WriteLine($"Average CS: {cash / cashC:F2}");
- Console.WriteLine($"Average CS: {card / cardC:F2}");
- break;
- }
- if (counter % 2 != 0)
- {
- if (money > 0 && money <= 100)
- {
- cash += money;
- Console.WriteLine("Product sold!");
- cashC++;
- }
- else
- {
- Console.WriteLine("Error in transaction!");
- }
- }
- else
- {
- if (money > 10)
- {
- card += money;
- Console.WriteLine("Product sold!");
- cardC++;
- }
- else
- {
- Console.WriteLine("Error in transaction!");
- }
- }
- }
- else
- {
- Console.WriteLine("Failed to collect required money for charity.");
- break;
- }
- if ((cash + card) >= sum)
- {
- Console.WriteLine($"Average CS: {cash / cashC:F2}");
- Console.WriteLine($"Average CC: {card / cardC:F2}");
- break;
- }
- counter++;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment