C# Sharp Exercises: Display alphabet pattern like U with an asterisk
C# Sharp For Loop: Exercise-78 with Solution
Write a C# Sharp program to display alphabet pattern like 'U' with an asterisk.
Pictorial Presentation:
Sample Solution:
C# Sharp Code:
using System;
public class Exercise78
{
public static void Main()
{
int row,column;
Console.Write("\n\n");
Console.Write("Display the pattern like 'U' 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 || column == 5) && row != 6) || (row == 6 && column > 1 && column < 5))
Console.Write("*");
else
Console.Write(" ");
}
Console.Write("\n");
}
Console.Write("\n");
}
}
Sample Output:
Display the pattern like 'U' 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 'T' with an asterisk.
Next: Write a C#Sharp program to display alphabet pattern like 'V' with an asterisk.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework