Advertisement
ostyleo

Untitled

Jan 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 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 PregatireExamen {
  8.     class Swaping {
  9.         public void swap(ref int x, ref int y) {
  10.             int a, b; a = x; b = y; swap2(ref a, ref b);
  11.         }
  12.         public void swap2(ref int a, ref int b) {
  13.             int temp; temp = a; a = b; b = a;
  14.         }
  15.         static void Main(string[] args) {
  16.             Swaping n = new Swaping();
  17.             int a = 100;
  18.             int b = 200;
  19.             n.swap(ref a, ref b);
  20.             Console.WriteLine(a+" "+b);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement