Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Ex03_PrintingTriangle
- {
- using System;
- public class Program
- {
- public static void Main()
- {
- int num = int.Parse(Console.ReadLine());
- PrintTriangle(num);
- }
- public static void PrintCol(int i)
- {
- for (int j = 1; j <= i; j++)
- {
- Console.Write($"{j} ");
- }
- Console.WriteLine();
- }
- public static void PrintTriangle(int n)
- {
- for (int i = 1; i <= n; i++)
- {
- PrintCol(i);
- }
- for (int i = n - 1; i >= 1; i--)
- {
- PrintCol(i);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment