Advertisement
Sabev

World Of Codecraft

Feb 5th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Fundamentals
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<double> temperature = new List<double>();
  14.             for (int i = 0; i < 10; i++)
  15.             {
  16.                 temperature.Add(double.Parse(Console.ReadLine()));
  17.             }
  18.            
  19.  
  20.             string output = $"The lowest temperature is {temperature.Min()} degrees. The coders are off to battle!";
  21.  
  22.             if (temperature.Min() < -10.0)
  23.             {
  24.                
  25.                output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
  26.             }
  27.             else if (temperature.Max() > 45.0)
  28.             {
  29.                 output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
  30.             }
  31.             else
  32.             {
  33.                 for (int i = 0; i < temperature.Count; i++)
  34.                 {
  35.                     if (isLow(temperature[i]) && i <= temperature.Count() - 5)
  36.                     {
  37.                         output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
  38.                     }
  39.                 }
  40.             }
  41.  
  42.            
  43.             Console.WriteLine(output);
  44.         }
  45.         private static bool isLow (double value)
  46.         {
  47.             if (value >= -10 && value <= 0)
  48.             {
  49.                 return true;
  50.             }
  51.             return false;
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement