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
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…
PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…
PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…