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 ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Program2.task4();
- Program2.task5();
- }
- }
- class Program2
- {
- public static void task4()
- {
- var a = Console.ReadLine();
- var b = "";
- double val = double.Parse(Console.ReadLine());
- double constant;
- switch (a)
- {
- case "miles":
- constant = 1.6;
- b = "kilometers";
- break;
- case "inches":
- constant = 2.54;
- b = "centimeters";
- break;
- case "feet":
- constant = 30;
- b = "centimeters";
- break;
- case "yards":
- constant = 0.91;
- b = "meters";
- break;
- case "gallons":
- constant = 3.8;
- b = "liters";
- break;
- default:
- constant = 1;
- b = "";
- break;
- }
- Console.Write(val);
- Console.Write(" ");
- Console.Write(a);
- Console.Write(" = ");
- Console.Write(Math.Round(val * constant, 2));
- Console.Write(" ");
- Console.WriteLine(b);
- }
- public static void task5()
- {
- var a = Console.ReadLine();
- long f1 = 0;
- double f2 = 0;
- if(!long.TryParse(a, out f1))
- {
- Console.WriteLine("Rainy");
- }
- else
- {
- long.TryParse(a, out f1);
- if (f1 >= sbyte.MinValue && f1 <= sbyte.MaxValue) Console.WriteLine("Sunny");
- else if (f1 >= int.MinValue && f1 <= int.MaxValue) Console.WriteLine("Cloudy");
- else if (f1 >= long.MinValue && f1 <= long.MaxValue) Console.WriteLine("Windy");
- else Console.WriteLine("nope");
- //else if (f1 >= double.MinValue || f1 <= double.MinValue) Console.WriteLine("Rainy");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment