C#: Display alphabet pattern like B with an asterisk
C# Sharp For Loop: Exercise-59 with Solution
Write a C# Sharp program to display an alphabet pattern like B with an asterisk.
Pictorial Presentation:

Sample Solution:
C# Sharp Code:
using System;
public class Exercise59
{
public static void Main()
{
int row,column;
Console.Write("\n\n");
Console.Write("Display the pattern like 'B' with an asterisk:\n");
Console.Write("---------------------------------------------");
Console.Write("\n\n");
for(row=0;row<=6;row++)
{
for (column=0; column<=6; column++)
{
if (column == 1 || ((row == 0 || row == 3 || row == 6) && (column < 5 && column > 1)) || (column == 5 && (row != 0 && row != 3 && row != 6)))
Console.Write("*");
else
Console.Write(" ");
}
Console.Write("\n");
}
Console.Write("\n");
}
}
Sample Output:
Display the pattern like 'B' with an asterisk: --------------------------------------------- **** * * * * **** * * * * ****
Flowchart:

C# Sharp Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a C#Sharp program to display alphabet pattern like 'A' with an asterisk.
Next: Write a C#Sharp program to display alphabet pattern like 'C' with an asterisk.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook