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