ostyleo

Untitled

Jan 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. namespace PregatireExamen {
  2.     class Swaping {
  3.         public void swap(ref int x, ref int y) {
  4.             int a, b; a = x; b = y; swap2(ref a, ref b);
  5.         }
  6.         public void swap2(ref int a, ref int b) {
  7.             int temp; temp = a; a = b; b = temp;
  8.         }
  9.         static void Main(string[] args) {
  10.             Swaping n = new Swaping();
  11.             int a = 100;
  12.             int b = 200;
  13.             n.swap(ref a, ref b);
  14.             Console.WriteLine(a+" "+b);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment