Advertisement
silvana1303

beer kegs

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