Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- //https://softuni.bg/trainings/resources/officedocument/11946/presentation-programming-fundamentals-january-2017
- namespace MethodsDemo
- {
- public class Methods
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- PrintTriangle(n);
- Console.ReadLine();
- }
- public static void PrintColumns(int row)
- {
- for (int col = 1; col <= row; col++)
- {
- Console.Write($"{col} ");
- }
- Console.WriteLine();
- }
- public static void PrintTriangle(int n)
- {
- for (int row = 1; row <= n; row++)
- {
- PrintColumns(row);
- }
- for (int row = n - 1; row >= 1; row--)
- {
- PrintColumns(row);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment