Q:

Write a C# Sharp program to display alphabet pattern like R with an asterisk

0

Write a C# Sharp program to display alphabet pattern like R with an asterisk

Sample Output:

Display the pattern like 'R' with an asterisk:                                                              
---------------------------------------------                                                               
 ****                                                                                                       
 *   *                                                                                                      
 *   *                                                                                                      
 ****                                                                                                       
 * *                                                                                                       
 *  *                                                                                                       
 *   *

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise75
{  
    public static void Main()
        {
    int row,column; 
   
    Console.Write("\n\n");
    Console.Write("Display the pattern like 'R' 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) && column > 1 && column < 5) || (column == 5 && row != 0 && row < 3) || (column == row - 1 && row > 2))
            Console.Write("*");
             else
              Console.Write(" ");
            }
            Console.Write("\n");
        }
	Console.Write("\n");
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now