Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Declare two integer variables and assign them with 5 and 10 and after that exchange their values.
- using System;
- class ExchangeValues
- {
- static void Main()
- {
- int firstValue = 5;
- int secondValue = 10;
- Console.WriteLine("If your numbers are {0} and {1}!", firstValue, secondValue);
- firstValue = firstValue + secondValue;
- secondValue = firstValue - secondValue;
- firstValue = firstValue - secondValue;
- Console.WriteLine("After the exchange the values are {0} and {1}!", firstValue, secondValue);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement