Review questions for quiz 3

1)   First, we fix errors from a previous quiz. What is the output of the following:

$sum=0;
$a=1;

while($a<9)
{
        $b=2;
  
     while( $b<7)
        {
                $sum=$sum+$a+$b;
                print "A is $a  B is $b  Sum is $sum\n";
                $b=$b+2;
        }
   
$a=$a+5;

}

print "A is $a  B is $b  Sum is $sum\n";
---------------------------------------------------
2) What is the output 

for( $a=10; $a>=1;$a--)
{

    for($b=1;$b<=10;$b++)
    {

        if ( $b < $a )
        {
            print ' ';      # print a space
         }
        else
        {
            print '*';     # print a *
        }

    }
    print "\n";
}


3)  You'll need to type these in and see what happens. What is the output ?

#!/usr/bin/perl
use strict;

my @ar=qw<mary joe sue ed jose>;
my $a;
my $b;

$a=3;
$b=$a+@ar;
print "B is $b\n";

4) Write a complete perl program that declares an array called "numbers" and fills up the first ten slots of the array
with entries such that each entry is 3 times its index. In other words:
    $numbers[0]=0
    $numbers[1]=3
    $numbers[2]=6
    $numbers[3]=9
    etc.
YOU MUST USE A LOOP!

5) Write a perl subroutine that can find the minimum of any number of parameters. That is, we could have in a program:
$a=&min(10,20,30);                        # $a is assigned 10
$a=&min(50,30,44,67,3,66);            # $a is assigned 3