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