Advertisement
Feni_Moore

help

May 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 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. using System.IO;
  7.  
  8. namespace num2
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Console.Write("Введите название файла: ");
  15.             string name = Console.ReadLine();
  16.             StreamWriter f2 = new StreamWriter(@name + ".txt");
  17.             int N;
  18.             string str1 = string.Empty,
  19.                     str2 = string.Empty;
  20.             Console.Write("Введите значение N: ");
  21.             N = Convert.ToInt32(Console.ReadLine());
  22.             if (N > 26)
  23.                 N = 26;
  24.             else if (N < 1)
  25.                 N = 1;
  26.             for (int i = 1; i <= N; i++)
  27.             {
  28.                 str1 = str1 + Convert.ToChar(i + 64);
  29.                 str2 = string.Empty; ;
  30.                 for (int j = i; j < N; j++)
  31.                     str2 = str2 + '*';
  32.                 f2.WriteLine( str1 + str2);
  33.                 Console.WriteLine(str1 + str2);
  34.             }
  35.             f2.Close();
  36.             Console.ReadKey();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement