Saturday 30 July 2016

Star Programming 7

Introduction


Hi guys, today I will show you how to write a basic star programming in C#, this is generally helpful to the fresher and whoever preparing for interviews.

My previous article was Star Programming 6

static void Main(string[] args)
{
    Console.WriteLine("Please Enter a number");
    int num = Convert.ToInt32(Console.ReadLine());
    for (int i = num; i>0; i--)
    {
        for (int k = i; k < num; k++)
        {
            Console.Write(" ");
        }
        for (int j = 0; j < i; j++)
        {
            Console.Write("*");
        }
        Console.WriteLine();
    }
}

No comments:

Post a Comment