Advertisement
ElviraPetkova

beerKegs

Jan 30th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08._Beer_Kegs
  4. {
  5.     public class Program
  6.     {
  7.         public static void Main()
  8.         {
  9.             int counter = int.Parse(Console.ReadLine());
  10.             double maxVolume = double.MinValue;
  11.             string winnKegs = string.Empty;
  12.  
  13.             for (int i = 0; i < counter; i++)
  14.             {
  15.                 string modelKegs = Console.ReadLine();
  16.                 double radius = double.Parse(Console.ReadLine());
  17.                 int height = int.Parse(Console.ReadLine());
  18.  
  19.                 double volumeOfKegs = Math.PI * (Math.Pow(radius, 2)) * height ;    //π * r^2 * h.
  20.  
  21.                 if(maxVolume < volumeOfKegs)
  22.                 {
  23.                     maxVolume = volumeOfKegs;
  24.                     winnKegs = modelKegs;
  25.                 }
  26.             }
  27.  
  28.             Console.WriteLine(winnKegs);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement