Anzzhhela98

фф

Jun 18th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Басейн
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int V = int.Parse(Console.ReadLine());
  10.             int p1 = int.Parse(Console.ReadLine());
  11.             int p2 = int.Parse(Console.ReadLine());
  12.             double hours = double.Parse(Console.ReadLine());
  13.  
  14.             double litersP1 = (p1 * hours);
  15.             double litersP2 = (p2 * hours);
  16.             double V1 = (litersP2 + litersP1) / 10;
  17.  
  18.             double allPrecent = ((p1 + p2 )/ V )* 100;
  19.             double precentP1 = (litersP1 / V1) * 10;
  20.             double precentP2 = (litersP2 / V1) * 10;
  21.  
  22.             if (litersP1 + litersP2 <= V)
  23.             {
  24.  
  25.                 Console.WriteLine($"The pool is {V1}% full. Pipe 1: {precentP1:f2}%. Pipe 2: {precentP2:f2}%. ");
  26.             }
  27.             else
  28.             {
  29.  
  30.                 Console.WriteLine($"For {hours:f2} hours the pool overflows with {(litersP1 + litersP2) - V:f2} liters.");
  31.             }
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment