Advertisement
dragonbs

Beer Kegs

Feb 2nd, 2023
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. int numberOfKegs = int.Parse(Console.ReadLine());
  2.  
  3. string bestModel = "";
  4. double biggestVolume = 0;
  5.  
  6. for (int i = 0; i < numberOfKegs; i++)
  7. {
  8.     string model = Console.ReadLine();
  9.     double radius = double.Parse(Console.ReadLine());
  10.     int height = int.Parse(Console.ReadLine());
  11.  
  12.     double volume = Math.PI * Math.Pow(radius, 2) * height;
  13.  
  14.     if (volume > biggestVolume)
  15.     {
  16.         biggestVolume = volume;
  17.         bestModel = model;
  18.     }
  19. }
  20. Console.WriteLine(bestModel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement