Advertisement
silvana1303

beer kegs

Jun 19th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Diagnostics.CodeAnalysis;
  5. using System.Linq;
  6. using System.Threading;
  7.  
  8. namespace ConsoleApp1
  9. {
  10.     class Exam
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int times = int.Parse(Console.ReadLine());
  15.  
  16.             string bestKeg = string.Empty;
  17.             double maxKeg = 0;
  18.  
  19.             for (int i = 0; i < times; i++)
  20.             {
  21.                 string kegType = Console.ReadLine();
  22.                 double radius = double.Parse(Console.ReadLine());
  23.                 int height = int.Parse(Console.ReadLine());
  24.  
  25.                 double formula = 3.14 * radius * radius * height;
  26.  
  27.                 if (formula > maxKeg)
  28.                 {
  29.                     maxKeg = formula;
  30.                     bestKeg = kegType;
  31.                 }
  32.             }
  33.  
  34.             Console.WriteLine(bestKeg);
  35.            
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement