Advertisement
Guest User

ConsoleApplication2

a guest
Nov 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             String firstStr = "_)(^%*))&%*";
  14.             String endStr = "";
  15.             int n = 0;
  16.  
  17.             for (int i = 0; i < firstStr.Length; i++)
  18.             {
  19.                 if ('a' <= firstStr[i] && firstStr[i] <= 'z' || 'A' <= firstStr[i] && firstStr[i] <= 'Z')
  20.                 {
  21.                     endStr += firstStr[i];
  22.                     n++;
  23.                 }
  24.             }
  25.            
  26.             if (n > 0) {
  27.                 Console.WriteLine("исходная строка: " + firstStr);
  28.                 Console.WriteLine("преобразованная строка: " + endStr);
  29.             }
  30.             else
  31.                 Console.WriteLine("Пустая строка или отсутствуют буквы алфавита!");
  32.             Console.ReadLine();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement