Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fundamentals
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<double> temperature = new List<double>();
- for (int i = 0; i < 10; i++)
- {
- temperature.Add(double.Parse(Console.ReadLine()));
- }
- string output = $"The lowest temperature is {temperature.Min()} degrees. The coders are off to battle!";
- if (temperature.Min() < -10.0)
- {
- output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
- }
- else if (temperature.Max() > 45.0)
- {
- output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
- }
- else
- {
- for (int i = 0; i < temperature.Count; i++)
- {
- if (isLow(temperature[i]) && i <= temperature.Count() - 5)
- {
- output = $"The lowest temperature is {temperature.Min():f1} degrees. The coders rest.";
- }
- }
- }
- Console.WriteLine(output);
- }
- private static bool isLow (double value)
- {
- if (value >= -10 && value <= 0)
- {
- return true;
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement