C# Program toward Print Triangle in SquareProgram Statement:Write a program which display the following output at the screen.
####$####
###$#$###
##$###$##
#$#####$#
$#######$
Solution:
class shape
{
int x, y;
public void sh()
{
Console.WriteLine();
beneficial to (x = 1; x <= 5; x++)
{
beneficial to (y = 1; y <= 5 - x; y++)
{
Console.Write("#");
}
Console.Write("$");
beneficial to (y = 2; y <= x * 2 - 1; y++)
{
Console.Write("#");
}
Console.Write("\b$");
beneficial to (y = 1; y <= 5 - x; y++)
{
Console.Write("#");
}
Console.WriteLine("\n");
}
}
}