Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace num2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите название файла: ");
- string name = Console.ReadLine();
- StreamWriter f2 = new StreamWriter(@name + ".txt");
- int N;
- string str1 = string.Empty,
- str2 = string.Empty;
- Console.Write("Введите значение N: ");
- N = Convert.ToInt32(Console.ReadLine());
- if (N > 26)
- N = 26;
- else if (N < 1)
- N = 1;
- for (int i = 1; i <= N; i++)
- {
- str1 = str1 + Convert.ToChar(i + 64);
- str2 = string.Empty; ;
- for (int j = i; j < N; j++)
- str2 = str2 + '*';
- f2.WriteLine( str1 + str2);
- Console.WriteLine(str1 + str2);
- }
- f2.Close();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement