Guest User

Untitled

a guest
Apr 5th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace proben
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int quota = int.Parse(Console.ReadLine());
  10.             double wonMoney = 0;
  11.             double lostMoney = 0;
  12.             double fishWorth = 0;
  13.             int fishCounter = 0;
  14.             bool quotaFullfilled = true;
  15.             for (int i = 1; i <= quota; i++)
  16.             {
  17.  
  18.                 int asciiFish = 0;
  19.                 string fish = Console.ReadLine();
  20.                 if (fish == "Stop")
  21.                 {
  22.                     quotaFullfilled = false;
  23.                     break;
  24.                 }
  25.                 fishCounter++;
  26.                 foreach (char c in fish)
  27.                 {
  28.                     asciiFish += (char)c;
  29.                 }
  30.                 double fishKg = double.Parse(Console.ReadLine());
  31.                 fishWorth = asciiFish / fishKg;
  32.                 if (i % 3 == 0) { wonMoney += fishWorth; }
  33.                 else
  34.                 {
  35.                     lostMoney += fishWorth;
  36.                 }
  37.             }
  38.             if (quotaFullfilled)
  39.             {
  40.                 Console.WriteLine("Lyubo fulfilled the quota!");
  41.             }
  42.          
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment