
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- C Program for Arrow Star Pattern
- C++ Programs To Create Pyramid and Pattern
- C program to print hollow rectangle star pattern
- Printing Different pattern Bash in C++
- Print Pyramid Star Pattern in Java Program
- Java Program to Print Pyramid 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
- Python Program to Print an Inverted Star Pattern
- Golang Program to Print an Inverted Star Pattern
- Java Program to Print Left Triangle Star Pattern
- Java Program to Print Upper Star Triangle Pattern
Advertisements