A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C# Sharp program to display alphabet pattern like G with an asterisk
Q:

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

0

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

Sample Output:

Display the pattern like 'G' 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 Exercise64
{  
    public static void Main()
        {
    int row,column; 
   
    Console.Write("\n\n");
    Console.Write("Display the pattern like 'G' 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 != 6) || ((row == 0 || row == 6) && column > 1 && column < 5) || (row == 3 && column > 2 && column < 6) || (column == 5 && row != 0 && row != 2 && row != 6))
              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