Advertisement
rosenrusev

Problem 10 - Exchange Variable Values

Mar 11th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ExchangeVariableValues
  7. {
  8. class ExchangeVariableValues
  9. {
  10. static void Main()
  11. {
  12. int a = 5;
  13. int b = 10;
  14.  
  15. a = a + b;
  16. b = a - b;
  17. a = a - b;
  18.  
  19. Console.WriteLine("Values before: a = 5 \n b = 10");
  20. Console.WriteLine("Values after: a = {0}\n b = {1}", a, b);
  21. }
  22. }
  23. }
  24. // Console Output:
  25. // Values before: a = 5
  26. // b = 10
  27. // Values after: a = 10
  28. // b = 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement