/NumberPatternsCSharp

A C# program that generates various shape patterns using loops and asterisks.

Primary LanguageC#MIT LicenseMIT

Number Patterns with C Sharp

Brief:

A C# program that generates various shape patterns using loops and asterisks.

Solution explained:

Namespace and Class: the code is organized within the NumberPatterns namespace, and the PatternGenerator class is responsible for generating the patterns.

Main Method: the program starts here. Displays the pattern choices to the user and reads their input.

Switch Statement: based on the user's choice, this decides which pattern function to call.

Print Functions: each pattern (Square, Right-Angle Triangle, Diamond, and Hexagon) has its own function that uses loops to print the pattern. The new string(char, count) constructor creates a string with repeated characters.

Loops: use for loops to print patterns line by line.

Note:

The solution was created in Visual Studio IDE 2022 by Microsoft (Free) with C# V.7.0.