In this article, we will discuss the concept of the C# Full Pyramid star pattern program using a for loop.
In this post, we will learn how to write a program in the C# programming language to print the full pyramid star pattern.
To create a full pyramid in C#, you need to print spaces and stars in the appropriate manner so that the stars form the pyramid’s shape.
Here’s a simple program to print a full pyramid pattern based on the number of rows provided.
Program 1
using System; public class Pyramid_Pattern { public static void Main(string[] args) { Console.WriteLine ("Enter a number for rows"); int x=int.Parse(Console.ReadLine ());//number of rows for(int i=1; i<=x; i++){ for(int j=1; j<=x-i; j++){ Console.Write (" "); } for(int k=1; k<=(i*2-1); k++){ Console.Write ("*"); } Console.WriteLine (); } Console.ReadLine (); } }
When the above code is executed, it produces the following result
Explanation
Similar post
Java program to print star pyramid pattern
C program to print star pyramid pattern
C++ program to print star pyramid pattern
Python program to print star pyramid pattern
Floyd’s triangle number pattern using for loop in C
Floyd’s triangle pattern using nested for loop in Java
Floyd’s triangle pattern using nested while loop in Java
Hollow pyramid triangle pattern in C++ language
Rhombus pattern in Java using for loop
Rhombus pattern in C using while loop
Rhombus pattern in C++ using do-while loop
Explanation of one dimensional array In this post, we will discuss the concept of "Explanation…
Python program to calculate the sum of odd and even numbers in a list In…
Python code to Calculate sum of odd and even in a list In this tutorial,…
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…