Advertisement
rosenrusev

Problem 10 - ExchangesVariableValuesWithContainer

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