Advertisement
AziLif

Вывод имени

Jun 4th, 2024 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             char sumbol;
  10.             string stringWithLetters = "";
  11.             string stringWithName;
  12.             string name;
  13.             string space = " ";
  14.  
  15.             Console.WriteLine("Введите свое имя:");
  16.             name = Console.ReadLine();
  17.            
  18.             Console.WriteLine("Укажите какой-бы символ вам хотелось?");
  19.             sumbol = Convert.ToChar(Console.ReadLine());
  20.            
  21.             stringWithName = sumbol + space + name + space + sumbol;
  22.  
  23.             for (int i = 0; i < stringWithName.Length; i++)
  24.             {
  25.                 stringWithLetters += sumbol;
  26.             }
  27.            
  28.             Console.WriteLine(stringWithLetters);
  29.             Console.WriteLine(stringWithName);
  30.             Console.WriteLine(stringWithLetters);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement