Advertisement
Torgach

swapping values

Oct 6th, 2022 (edited)
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 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 Основы.Практика
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             string firstName = "Ivanov";
  14.             string lastName = "Ivan";
  15.  
  16.             Console.WriteLine($"Имя: {firstName}. Фамилия: {lastName}.\n");
  17.  
  18.             string tempName = lastName;
  19.             lastName = firstName;
  20.             firstName = tempName;
  21.  
  22.             Console.WriteLine($"Имя: {firstName}. Фамилия: {lastName}.");
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement