Update SO.1 {TECHMANDAN} PŘIVÍTÁNÍ.cs

This commit is contained in:
Daniel Bulant 2021-10-31 17:05:12 +01:00 committed by GitHub
parent 38555c2624
commit 95886dc4fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,38 +1,19 @@
using System; using System;
namespace PVAukol namespace welcome
{ {
class Program class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
int cas = DateTime.Now.Hour;
Console.Write("Vaše jméno: "); Console.Write("Vaše jméno: ");
string jmeno = Console.ReadLine(); var name = Console.ReadLine();
string doba; var hour = DateTime.Now.Hour;
string time;
if (cas < 12) if(hour < 12) time = "Dobré ráno";
{ else if(hour > 12 && hour < 18) time = "Dobré odpoledne";
doba = "rána"; else time = "Dobrý večer";
} Console.WriteLine($"{time}, {name}");
else if(cas >= 12 && cas < 18)
{
doba = "odpoledne";
}
else
{
doba = "večera";
}
Console.WriteLine($"Dobrého {doba}, ti přeji {jmeno}.");
} }
} }
} }