Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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 ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. algorytm1();
  14. Console.Read();
  15.  
  16. }
  17. static int pobierzLiczbe()
  18. {
  19. Console.WriteLine("Podaj liczbe:");
  20. return int.Parse(Console.ReadLine());
  21. }
  22. static void algorytm1()
  23. {
  24. int liczba = pobierzLiczbe();
  25. if (kontrolaParzystosci(liczba))
  26. {
  27. Console.WriteLine("Parzysta");
  28. }
  29. else
  30. {
  31. Console.WriteLine("Nieparzysta");
  32. }
  33. }
  34. static bool kontrolaParzystosci(int liczba)
  35. {
  36. if (liczba % 2 == 0)
  37. {
  38. return true;
  39. }
  40. return false;
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement