Advertisement
ElviraPetkova

beer

Jan 30th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2.    
  3. namespace beer_kegs
  4. {
  5.         class Program
  6.         {
  7.             static void Main(string[] args)
  8.             {
  9.             int n = int.Parse(Console.ReadLine());
  10.  
  11.             string biggestModel = "";
  12.             double biggestVolume = 0;
  13.  
  14.             for (int i = 1; i <= n; i++)
  15.             {
  16.                 string model = Console.ReadLine();
  17.                 double radius = double.Parse(Console.ReadLine());
  18.                 int height = int.Parse(Console.ReadLine());
  19.  
  20.                 double volume = Math.PI * radius * radius * height;
  21.  
  22.                 if (volume > biggestVolume)
  23.                 {
  24.                     biggestModel = model;
  25.                     biggestVolume = volume;
  26.                 }
  27.             }
  28.             Console.WriteLine(biggestModel);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement