slemiba

L02-04 Napszakok

Sep 11th, 2022
867
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 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 ConsoleApp8
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Hány óra van? ");
  14.             int ora = int.Parse(Console.ReadLine());
  15.  
  16.             if (6 <= ora && ora < 10)
  17.             {
  18.                 Console.WriteLine("Jó reggelt!");
  19.             }
  20.             else if (10 <= ora && ora < 18)
  21.             {
  22.                 Console.WriteLine("Jó napot!");
  23.  
  24.             }
  25.             else if ((18 <= ora && ora <24) ||(0 <= ora && ora < 6))
  26.             {
  27.                 Console.WriteLine("Jó estét!");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine("Érvénytelen óra! Legközelebb egy 0 és 23 közötti értéket adj meg!");
  32.             }
  33.            
  34.         }
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment