Saturday 22 November 2014

Star Pattern in C# - 3

Star Pattern in C-sharp
Fig 1: Snapshots of output


using System;
class Pattern_Test3
{
public static void Main()
{
int i=1;
int row;
int j;

Console.Write("Enter no. of row you have to print: ");
row=Convert.ToInt32(Console.ReadLine());

for(;row>0;row--,i++)
{
for(j=i;j>1;j--)
Console.Write(" ");

for(int c=0;c<row;c++)
Console.Write("*");
Console.WriteLine();
}
}
}