Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Weather
- {
- class Program
- {
- static void Main()
- {
- string weather = Console.ReadLine();
- if (weather == "sunny")
- {
- Console.WriteLine("It's warm outside!");
- }
- else
- {
- Console.WriteLine("It's cold outside!");
- }
- }
- }
- }
- Решение с тернарен оператор:
- using System;
- namespace Weather
- {
- class Program
- {
- static void Main()
- {
- string weather = Console.ReadLine();
- string print = weather == "sunny" ? "It's warm outside!" : "It's cold outside!";
- Console.WriteLine(print);
- }
- }
- }
- Тарикатско решение:)
- using System;
- namespace Weather
- {
- class Program
- {
- static void Main()
- {
- Console.WriteLine($"It's {(Console.ReadLine() == "sunny" ? "warm" : "cold")} outside!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement