Advertisement
Guest User

fv, metosud hivas

a guest
Oct 17th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 _00_vm_3_ora
  8. {
  9. class Program
  10. {
  11. //beolvasás és kiíratás fv ben történjen
  12. //a beolvastt szám +/- és páros v. páratlan
  13.  
  14. static void Main(string[] args)
  15. {
  16. Console.Write("Adj egy számot: ");
  17.  
  18. int szam = beolvas();
  19.  
  20. if (szam == 0)
  21. {
  22. kiir("A szám nulla!");
  23. }
  24. else if (szam%2==0)
  25. {
  26. kiir("A szám páros és ");
  27. }
  28. else
  29. {
  30. kiir("A szám páratlan és ");
  31. }
  32.  
  33. if (szam > 0)
  34. {
  35. kiir("pozitív.");
  36. }
  37. else if (szam == 0)
  38. {
  39. //Console.Write("nulla.");
  40. }
  41. else
  42. {
  43. kiir("negatív.");
  44. }
  45.  
  46. Console.ReadLine();
  47. }
  48.  
  49. static void kiir(string szoveg)
  50. {
  51. Console.Write(szoveg);
  52. }
  53.  
  54. static int beolvas()
  55. {
  56. return int.Parse(Console.ReadLine());
  57.  
  58.  
  59. }
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement