Q:

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

0

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

Sample Output:

Display the pattern like 'M' 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 Exercise70
{  
    public static void Main()
        {
    int row,column; 
   
    Console.Write("\n\n");
    Console.Write("Display the pattern like 'M' 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 == 2 && (column == 2 || column == 4)) || (row == 3 && column == 3))
              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