printing(newbie)

  • Thread starter Thread starter jed
  • Start date Start date
J

jed

I need to print a rectangle like this ******
* *
* *
* *
******
It will have a fixed width but I want a text box in which i can insert
the number of vertical stars.please any ideas code will be
useful.thanks
 
int vertical = 5;
for (int j = 0; j < vertical; j++)
{
for (int i = 0; i < 6; i++)
{
if (j == 0 || j == (vertical - 1))
Console.Write("*");
else
{
if(i==0||i==5)
Console.Write("*");
else
Console.Write(" ");
}
}
Console.WriteLine("");
}

hi this is code snippent .here vertical is lenght u can assing it any
value. hope it will sove ur prob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top