Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Fishing
- {
- class Program
- {
- static void Main(string[] args)
- {
- double quote = double.Parse(Console.ReadLine());
- string name = string.Empty;
- double caught = 0;
- int counter = 0;
- double budget = 0;
- double moneyFromFish = 0;
- for (int i = 0; i <= quote;)
- {
- double charSum = 0;
- name = Console.ReadLine();
- if (name == "Stop")
- break;
- caught = double.Parse(Console.ReadLine());
- i++;
- for (int j = 0; j < name.Length; j++)
- {
- charSum += name[j];
- // Console.WriteLine(charSum);
- }
- counter++;
- moneyFromFish = charSum / caught;
- if (i == 3 || i == 6 || i == 9 || i == 12 || i == 15 || i == 18)
- {
- budget += moneyFromFish;
- }
- else
- {
- budget -= moneyFromFish;
- }
- if (i >= quote)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- break;
- }
- }
- if (budget >= 0)
- {
- Console.WriteLine($"Lyubo's profit from {counter} fishes is {budget:f2} leva.");
- }
- else
- {
- Console.WriteLine($"Lyubo lost {Math.Abs(budget):f2} leva today.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment