using System; using System.IO; using System.Text.RegularExpressions; public class Problem1 { public static void Main() { FileStream file = new FileStream("DATA1.txt", FileMode.Open); StreamReader sr = new StreamReader(file); String temp = sr.ReadToEnd(); String[] lines = Regex.Split(temp, "\n"); FileStream file2 = new FileStream("OUT1.txt", FileMode.Create); StreamWriter sw = new StreamWriter(file2); foreach (String line in lines) { if (line.Length == 0) break; int q = Convert.ToInt32(line[0].ToString()); Console.WriteLine(q); int stars = -1; for (int i = 1; i <= (q / 2) + 1; i++) { stars += 2; String lin = ""; int dots = (q - stars) / 2; String d = "", s = ""; for (int j = 0; j < dots; j++) { d += "."; } for (int k = 0; k < stars; k++) { s += "#"; } lin = d + s + d; sw.WriteLine(lin); } for (int i = (q / 2); i > 0; i--) { stars -= 2; String lin = ""; int dots = (q - stars) / 2; String d = "", s = ""; for (int j = 0; j < dots; j++) { d += "."; } for (int k = 0; k < stars; k++) { s += "#"; } lin = d + s + d; sw.WriteLine(lin); } } sw.Close(); file2.Close(); } }