Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01.BurgerBus
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfCities = int.Parse(Console.ReadLine());
- double totalProfit = 0;
- for (int i = 1; i <= numberOfCities; i++)
- {
- string nameOfTheCity = Console.ReadLine();
- double income = double.Parse(Console.ReadLine());
- double expenses = double.Parse(Console.ReadLine());
- double leftMoney = income - expenses;
- if (i % 5 == 0 && i % 3 == 0)
- {
- leftMoney -= leftMoney * 0.1;
- totalProfit += leftMoney;
- continue;
- }
- if (i % 5 == 0)
- {
- income -= income * 0.1;
- leftMoney = income - expenses;
- totalProfit += leftMoney;
- Console.WriteLine($"In {nameOfTheCity:f2} Burger Bus earned {leftMoney:f2} leva.");
- continue;
- }
- if (i % 3 == 0)
- {
- leftMoney -= expenses * 0.5;
- }
- totalProfit += leftMoney;
- Console.WriteLine($"In {nameOfTheCity} Burger Bus earned {leftMoney:f2} leva.");
- }
- Console.WriteLine($"Burger Bus total profit: {totalProfit:f2} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment