Advertisement
Guest User

return add value

a guest
Jan 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Uzd6
  6. {
  7. class Program
  8. {
  9. //metode Add darbojas šādi: x += y; turklāt tiek pārbaudīts vai operācija Add vispār iespējama.
  10. //Panākt, lai aktuālā parametra a vērtība pēc metodes izsaukšanas būtu izmainījusies
  11. public static int add(int x, int y)
  12. {
  13. return x + y;
  14.  
  15. }
  16.  
  17. static void Main(string[] args)
  18. {
  19. int a = 5;
  20. int b = 6;
  21.  
  22. Console.WriteLine("a={0}; b={1}", a, b);
  23.  
  24. if (add(a, b))
  25. {
  26. Console.WriteLine("a={0}", a);
  27. }
  28. else
  29. {
  30. Console.WriteLine("Pārpildīšanās kļūda");
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement