Advertisement
Guest User

Untitled

a guest
Dec 24th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PoolPipes
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var pool = int.Parse(Console.ReadLine());
  14.             var pipe1 = int.Parse(Console.ReadLine());
  15.             var pipe2 = int.Parse(Console.ReadLine());
  16.             var hours = double.Parse(Console.ReadLine());
  17.             var water = (pipe1 + pipe2) * hours;
  18.             var percentOfpool = pool / 100;
  19.             var fullPoolpercent = water / percentOfpool;
  20.             var waterInpoolPercent = water / 100;
  21.             var pipe1percent = (pipe1 * hours) / waterInpoolPercent;
  22.             var pipe2percent = (pipe2 * hours) / waterInpoolPercent;
  23.             if (water <= pool)
  24.             {
  25.                 Console.WriteLine($"The pool is {fullPoolpercent}% full." +
  26.                     $" Pipe 1: {(int)pipe1percent}%. Pipe 2: {(int)pipe2percent}%.");
  27.  
  28.             }
  29.             else if (water > pool)
  30.             {
  31.                 Console.WriteLine($"For {hours} hours the pool overflows with {(water - pool):F1} liters.");
  32.             }
  33.         }
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement