Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 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 ConsoleApplication3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int v = int.Parse(Console.ReadLine());
  14.             int p1 = int.Parse(Console.ReadLine());
  15.             int p2 = int.Parse(Console.ReadLine());
  16.             double h = double.Parse(Console.ReadLine());
  17.             double x, y, z;
  18.             double p = p1 * h;
  19.             double c = p2 * h;
  20.             x = (p + c) / 1000 * 100;
  21.             y = (p / (p + c)) * 100;
  22.             z = (c / (p + c)) * 100;
  23.             if (p + c > v)
  24.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, (p + c) - v);
  25.             else
  26.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)x, (int)y, (int)z);
  27.  
  28.         }
  29.     }
  30. }using System;
  31. using System.Collections.Generic;
  32. using System.Linq;
  33. using System.Text;
  34. using System.Threading.Tasks;
  35.  
  36. namespace ConsoleApplication3
  37. {
  38.     class Program
  39.     {
  40.         static void Main(string[] args)
  41.         {
  42.             int v = int.Parse(Console.ReadLine());
  43.             int p1 = int.Parse(Console.ReadLine());
  44.             int p2 = int.Parse(Console.ReadLine());
  45.             double h = double.Parse(Console.ReadLine());
  46.             double x, y, z;
  47.             double p = p1 * h;
  48.             double c = p2 * h;
  49.             x = (p + c) / 1000 * 100;
  50.             y = (p / (p + c)) * 100;
  51.             z = (c / (p + c)) * 100;
  52.             if (p + c > v)
  53.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, (p + c) - v);
  54.             else
  55.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)x, (int)y, (int)z);
  56.  
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement