Introducti on:
Here is the simple code Making pyramid using stars with spaces.
Example Program: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace interface1
{
class Program
{
interface pyramid
{
void tree1();
}
class pyramic1 : pyramid
{
publicvoid tree1()
{
for (int i = 1; i <= 8; i++)
{
for(int j = i; j <= 8; j++)
{
Console.Write(" ");
}
for(int k = 1; k <= i; k++)
{
Console.Write("* ");
}
Console.Write("\n");
}
Console.Read();
}
}
static void Main(string[]args)
{
pyramid p = new pyramic1();
p.tree1();
Console.ReadLine();
}
}
}
For more visit:
http://www.dotnetchallengers.com/App_Folder/Home/CodeSnippets.aspx