Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- namespace _4.PrintingTriangle
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int row = 1; row <= n; row++)
- {
- for (int col = 1; col <= row; col++)
- {
- Console.Write($"{col} ");
- }
- Console.WriteLine();
- }
- for (int row = n - 1; row > 0; row--)
- {
- for (int col = 1; col <= row; col++)
- {
- Console.Write($"{col} ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment