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.
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.
No comments :
Post a Comment