
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Different Star Pattern Programs in C#
Like any other programming languages such as C, C++, Java, we can easily display start pattern programs in C#.
Let us see them one by one.
Example
using System.IO; using System; class Program { static void Main() { for (int i = 1; i <= 6; ++i) { for (int j = 1; j <= i; ++j) { Console.Write("*"); } Console.WriteLine(); } } }
Output
* ** *** **** ***** ******
Let us see another series.
Example
using System.IO; using System; class Program { static void Main() { int i, j, k; int n = 6, // loop to print the series for (i = 1; i <= n; i++) { for (j = 1; j <= n - i; j++) { Console.Write(" "); } for (k = 1; k <= i; k++) { Console.Write("*"); } Console.WriteLine(""); } Console.ReadLine(); } }
Output
* ** *** **** ***** ******
Let us see another series.
Example
using System.IO; using System; class Program { static void Main() { for (int i = 6; i >= 1; --i) { for (int j = 1; j >= i; ++j) { Console.Write("*"); } Console.WriteLine(); } } }
Output
****** ***** **** *** ** *
Here is another series.
Example
using System.IO; using System; class Demo { static void Main() { int a = 1, spaces, k = 6, i = 0, j = 0; spaces = k - 1; for(i=1; i<k*2; i++) { for(j=1; j<=spaces; j++) { Console.Write(" "); } for(j=1; j<a*2; j++) { Console.Write("*"); } Console.WriteLine(""); if(i < k) { spaces--; a++; } else { spaces++; a--; } } } }
Output
* *** ***** ******* ********* *********** ********* ******* ***** *** *
- Related Articles
- C++ Programs To Create Pyramid and Pattern
- Print Pyramid Star Pattern in Java Program
- C Program for Arrow Star Pattern
- Java Program to Print Diamond Star Pattern
- Java Program to Print Square Star Pattern
- Java Program to Print 8 Star Pattern
- Java Program to Print Inverted Star Pattern
- Java Program to Print X Star Pattern
- Java Program to Print Pyramid Star Pattern
- Swift program to Print Pyramid Star Pattern
- Swift Program to Print Inverted Star Pattern
- Swift program to Print Diamond Star Pattern
- Swift program to Print Sandglass Star Pattern
- Golang Program To Print 8 Star Pattern
- Golang Program To Print Diamond Star Pattern

Advertisements