C# Program to Print Triangle in Square

C# Program to Print Triangle in Square - we say welcome to you who have been searching for information via search engines such as Google, in a blog Tech Gallery, now we will discuss information about the C# Program to Print Triangle in Square , we have been looking for a lot of information from a trusted and collect it in this blog, so you get the information complete and easy to understand, please read through:

Article Csharp, Article programs,

You can also see our article on:


C# Program to Print Triangle in Square

Program Statement:
Write a program which display the following output on the screen.
####$####
###$#$###
##$###$##
#$#####$#
$#######$

Solution:
 class shape
{
int x, y;
public void sh()
{
Console.WriteLine();
for (x = 1; x <= 5; x++)
{
for (y = 1; y <= 5 - x; y++)
{
Console.Write("#");
}
Console.Write("$");
for (y = 2; y <= x * 2 - 1; y++)
{
Console.Write("#");
}
Console.Write("\b$");
for (y = 1; y <= 5 - x; y++)
{
Console.Write("#");
}
Console.WriteLine("\n");
}
}
}



Information about the C# Program to Print Triangle in Square we have conveyed

A few of our information about the C# Program to Print Triangle in Square , I hope you can exploit carefully

You have finished reading C# Program to Print Triangle in Square and many articles about Tech Gallery in our blog this, please read it. and url link of this article is https://littlebitjohnny.blogspot.com/2013/12/c-program-to-print-triangle-in-square.html Hopefully discussion articles on provide more knowledge about the world of new tech gadgets.

Tag : , ,
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : C# Program to Print Triangle in Square

0 comments:

Post a Comment