Miguelven’s Weblog

May 12, 2009

Secuencias

Filed under: Cibernética — miguelven @ 5:42 pm

 

 

 

 

 

 

 

El siguiente procedimiento hace cuadros con asteriscos, siendo los asteriscos la unidad con la que se va a trabajar. Este procedimiento utiliza secuencias.

 

 

 

 

static void Main(string[] args)

{

Console.WriteLine(“Da un número: “);
int x = int.Parse(Console.ReadLine());
Console.WriteLine(“y = ” + area(3, x));
pinta(x, 4);
}
static int area(int x1, int x2)
{
return x1 * x2;
}
static void pinta(int x1, int x2)
{
int i, j;
Console.WriteLine();
for (i = 0; i < x1; i++)
{
for (j = 0; j < x2; j++)
{
if (i == 0 || i == x1 – 1)
{
Console.Write(“*”);
}
else if (j == 0 || j == x2 – 1)
{
Console.Write(“*”);
}
else
{
Console.Write(“”);
}
}
}
Console.WriteLine();
string y = Console.ReadLine();

}

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Banana Smoothie. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.