- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Pyramid
- {
- class Program
- {
- public static void print(int no)
- {
- for (int i = 1; i <= no; i++)
- {
- for (int j = i; j <= no; j++)
- {
- Console.Write(" ");
- }
- for (int k = 1; k <= 2 * i - 1; k++)
- {
- Console.Write("*" + " ");
- }
- Console.WriteLine();
- }
- Console.ReadLine();
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Enter the number of rows for the output");
- int r = Convert.ToInt32(Console.ReadLine());
- print(r);
- }
- }
- }
I am posting a simple method for printing a Pyramid type output given by the rows values.
