Powered by Blogger.

Print Star Pattern in C#



Print Star Pattern in C#

Hello friends once again we write C# code for Print Star Pattern Program in C# or Print Star Pattern in C#. For write this code we need looping concept and conditional concept.

Print Star Pattern in C#

Pattern 1

*
**
***
****
*****
******
*******
********

public class Star_Pattern_Program
{

    public static void Main(string[] args)
    {
        for (int row = 1; row <= 8; ++row)
        {
            for (int col = 1; col <= row; ++col)
            {
                Console.Write("*");
            }

            Console.WriteLine();
        }
    }
}

Pattern 2

********
*******
******
*****
****
***
**
*
 public class Star_Program
{
    public static void Main(string[] args)
    {
        for (int row = 8; row >= 1; --row)
        {
            for (int col = 1; col <= row; ++col)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}
I Hope this code is very helpful for all of you.



facebook
google-plus
twitter
pinterest

No comments :

Post a Comment

HTML Tutorial

images

About Sitesbay

This blog is related to Java Tutorial, C++ Tutorial, C Tutorial, Online Earning tips and more in very simple and easy way. Here i will try to give complete idea related to all new technology.

Java Tutorial

Java is Object oriented programming language, It is more secure and high performance language.

C++ Tutorial

C++ is also Object oriented programming language, It is more simple and easy to learn.

 
https://sitesbay.blogspot.com/?utm_medium=d2898efa59afcc0bc411921036e22b767ca37b09