Advertisement
Cassimus

Dni z if

Mar 22nd, 2025
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. System.Console.WriteLine("Podaj numer dnia tygodnia(1-7), a ja ci powiem jaki to dzień");
  2. short dzien = short.Parse(Console.ReadLine());
  3.  
  4. if (dzien == 1)
  5. {
  6.     System.Console.WriteLine($"{dzien} dzień tygodnia to poniedziałek");
  7. }
  8. else if (dzien == 2)
  9. {
  10.     System.Console.WriteLine($"{dzien} dzień tygodnia to wtorek");
  11. }
  12. else if (dzien == 3)
  13. {
  14.     System.Console.WriteLine($"{dzien} dzień tygodnia to środa");
  15. }
  16. else if (dzien == 4)
  17. {
  18.     System.Console.WriteLine($"{dzien} dzień tygodnia to czwartek");
  19. }
  20. else if (dzien == 5)
  21. {
  22.     System.Console.WriteLine($"{dzien} dzień tygodnia to piątek");
  23. }
  24. else if (dzien == 6)
  25. {
  26.     System.Console.WriteLine($"{dzien} dzień tygodnia to sobota");
  27. }
  28. else if (dzien == 7)
  29. {
  30.     System.Console.WriteLine($"{dzien} dzień tygodnia to niedziela");
  31. }
  32. else
  33. {
  34.     System.Console.WriteLine("Nieprawidlowy numer dnia tygodnia");
  35. }
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement