KpucTaJl

Перестановка местами значений

Aug 28th, 2023 (edited)
1,088
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLight
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string firstVariable = "Вячеслав";
  10.             string secondVariable = "Бугаев";
  11.  
  12.             Console.WriteLine("До перестановки:");
  13.             Console.WriteLine($"Значение первой переменной: {firstVariable}");
  14.             Console.WriteLine($"Значение второй переменной: {secondVariable}");
  15.  
  16.             (firstVariable, secondVariable) = (secondVariable, firstVariable);
  17.  
  18.             Console.WriteLine("\nПосле перестановки:");
  19.             Console.WriteLine($"Значение первой переменной: {firstVariable}");
  20.             Console.WriteLine($"Значение второй переменной: {secondVariable}");
  21.             Console.ReadKey();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment