Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P07_ExchangeVariableValues
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num1 = int.Parse(Console.ReadLine());
- int num2 = int.Parse(Console.ReadLine());
- bool isBefore = true;
- OutputTwoNumbers(num1, num2, isBefore);
- SwapIntValues(ref num1, ref num2, ref isBefore);
- }
- static void OutputTwoNumbers(int num1, int num2, bool isBefore)
- {
- Console.WriteLine("Before:");
- Console.WriteLine($"a = {num1}");
- Console.WriteLine($"b = {num2}");
- }
- static void SwapIntValues (ref int num1, ref int num2, ref bool isBefore)
- {
- Console.WriteLine("After:");
- Console.WriteLine($"a = {num2}");
- Console.WriteLine($"b = {num1}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement