bnovice
September 19th, 2004, 11:19 AM
I need to write a code for my homework result should should look like this:
********************
* empty spaces *
* empty spaces **
* empty spaces ***
* empty spaces ****
* *****
* ******
* *******
all the way down to this
********************
I wrote a "for loop" but with no help
my result comes too
********************
*
**
***
****
*****
******
*******
all the way down to this
********************
I wrote another "for loop" but with no help
my result comme to this
*********************
********************
*******************
all the way to this
*
*********************
Here is my source code
using System;
public class SquareWriteLine
{
public static void Main()
{
int column,height=20,width=20;
Console.WriteLine("-- Begin Shaded Square ({0} x {1})",20,20);
Console.Write("*"+"******************"+"*");
for (int row=0;row<height;++row)
{
for (column=0; column<row; column++)
Console.Write("*");
Console.WriteLine();
}
Console.WriteLine("*"+"******************"+"*");
Console.WriteLine("-- End Shaded Square ({0} x {1})",20,20);
}
}
Any help will be appreciated!!!
Bill
********************
* empty spaces *
* empty spaces **
* empty spaces ***
* empty spaces ****
* *****
* ******
* *******
all the way down to this
********************
I wrote a "for loop" but with no help
my result comes too
********************
*
**
***
****
*****
******
*******
all the way down to this
********************
I wrote another "for loop" but with no help
my result comme to this
*********************
********************
*******************
all the way to this
*
*********************
Here is my source code
using System;
public class SquareWriteLine
{
public static void Main()
{
int column,height=20,width=20;
Console.WriteLine("-- Begin Shaded Square ({0} x {1})",20,20);
Console.Write("*"+"******************"+"*");
for (int row=0;row<height;++row)
{
for (column=0; column<row; column++)
Console.Write("*");
Console.WriteLine();
}
Console.WriteLine("*"+"******************"+"*");
Console.WriteLine("-- End Shaded Square ({0} x {1})",20,20);
}
}
Any help will be appreciated!!!
Bill