hello friends,
I want to print Pyramid in C# using * .. if you have any
idea how can i make it then please help me i need your help...
Thanks In Advance
How To Make Peramid In C#
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


PJ MartinsRank #2,548 · 548 reputationPosted May 28, 2010, 7:08 AM EDT
// number of rows you wish to print
int rows = 10;
// variable to store number of stars to print
string rowPrint = string.Empty;
for (int i = 1; i <= rows; i++)
{
int numStars = 2 * i - 1;
rowPrint = string.Empty;
for (int j = 1; j <= numStars; j++)
rowPrint += "*";
Console.WriteLine(rowPrint.PadLeft(rows + i, ' '));
}