Advertisement
Guest User

alabala

a guest
Feb 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 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 IP_L01_P2
  8. {
  9. class A
  10. {
  11. public void M1()
  12. {
  13. Console.WriteLine("M1");
  14. }
  15.  
  16. public void M2()
  17. {
  18. Console.WriteLine("M2");
  19. }
  20.  
  21. public void M3(int n)
  22. {
  23. Console.WriteLine(n);
  24. }
  25.  
  26. public void M4(string n)
  27. {
  28. Console.WriteLine(n);
  29. }
  30. }
  31.  
  32. class B
  33. {
  34. public int suma(int n)
  35. {
  36. return n + 11;
  37. }
  38.  
  39. public int diferenta(int n, int x)
  40. {
  41. return n - x - 2;
  42. }
  43.  
  44. public int inmultire(int n)
  45. {
  46. return n * 4;
  47. }
  48.  
  49. public int impartire(int n)
  50. {
  51. return n / 5;
  52. }
  53. }
  54.  
  55. class C
  56. {
  57. public int suma(int n)
  58. {
  59. return n + 5;
  60. }
  61.  
  62. public int diferenta(int n, int x)
  63. {
  64. return n - x * 2;
  65. }
  66.  
  67. public int inmultire(int n)
  68. {
  69. return n * 5;
  70. }
  71.  
  72. public int impartire(int n)
  73. {
  74. return n / 24;
  75. }
  76. }
  77.  
  78.  
  79. class Program
  80. {
  81.  
  82. static void Main(string[] args)
  83. {
  84. A a = new A();
  85. a.M1();
  86. a.M2();
  87. a.M3(2);
  88. a.M4("ana are mere");
  89.  
  90. B b = new B();
  91. Console.WriteLine(b.suma(3));
  92. Console.WriteLine(b.diferenta(2, 4));
  93. Console.WriteLine(b.impartire(4));
  94.  
  95. C c = new C();
  96. Console.WriteLine(c.suma(3));
  97. Console.WriteLine(c.diferenta(2, 4));
  98. Console.WriteLine(c.impartire(4));
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement