Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- var v = int.Parse(Console.ReadLine());//1000
- var p1 = int.Parse(Console.ReadLine());//100
- var p2 = int.Parse(Console.ReadLine());//120
- var h = double.Parse(Console.ReadLine());//3
- var littresOfp1 = p1 * h;//300
- var littresOfp2 = p2 * h;//360
- var allTheLittres = littresOfp1 + littresOfp2;//660
- var percentOffullnes = Math.Floor(allTheLittres * 100 / v);//66%
- var percentOfP1 = Math.Floor(littresOfp1 * 100 / allTheLittres);//45%
- var percentOfP2 = Math.Floor(littresOfp2 * 100 / allTheLittres);//54%
- if (v >= allTheLittres)
- {
- Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", percentOffullnes, percentOfP1, percentOfP2);
- }
- else
- {
- Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, allTheLittres - v);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment