Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Writing sid...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 11029 of 11531
Post > Topic >>

Re: Writing side of square

by kratzers@[EMAIL PROTECTED] (Stephen Kratzer) May 5, 2008 at 11:18 AM

On Monday 05 May 2008 09:22:51 Rodrigo Tavares wrote:
> Hello,
>
> I need create a square using a single number, but I don't know how to
> create the sides.
>
> I have to create this:
>
> ****
> *  *
> *  *
> ****
>
> My code is below :
>
> print "Enter with number:";
> chomp ($number =3D <STDIN>);
>
> my @[EMAIL PROTECTED]
 =3D ();
>
> $cont =3D 0;
>
> while ($numero > $cont)
>  {
>  	$array[$cont]=3D"*";
>  	$cont++;
>  }
>
>  print @[EMAIL PROTECTED]
>  print "\n";
>  print @[EMAIL PROTECTED]
>  print "\n";
>
> How I can to show the arrar like sides ?
>
> []'s
>
> Faria
>
>
>       Abra sua conta no Yahoo! Mail, o =FAnico sem limite de espa=E7o
para
> armazenamento! http://br.mail.yahoo.com/

for (1..$n) {
        if ($_ =3D=3D 1 || $_ =3D=3D $n) {
                print "*" x $n, "\n";
        }
        else {
                print "*", " " x ($n - 2), "*\n";
        }
}
 




 4 Posts in Topic:
Writing side of square
digolinopage@[EMAIL PROTE  2008-05-05 06:22:51 
Re: Writing side of square
rob.dixon@[EMAIL PROTECTE  2008-05-05 15:33:03 
Re: Writing side of square
kratzers@[EMAIL PROTECTED  2008-05-05 11:18:08 
Re: Writing side of square
chas.owens@[EMAIL PROTECT  2008-05-05 17:18:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 19:21:02 CDT 2008.