Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Printing_Triangle
- {
- class Printing_Triangle
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- PrintTriangle(n);
- }
- static void PrintLine(int start, int end)
- {
- for (int i = start; i <= end; i++)
- {
- Console.Write(i + " ");
- }
- Console.WriteLine();
- }
- static void PrintTriangle(int n)
- {
- for (int line = 1; line <= n; line++)
- {
- PrintLine(1, line);
- }
- for (int line = n - 1; line >= 1; line--)
- {
- PrintLine(1, line);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment