#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    5
    Rep Power
    0

    How would you go about this?


    How would you write a Perl program that prints out all the even numbers from 0 to 20 using while, until, do-until and for loops? and print out the list 4times too?
    original question Code:
    Write a Perl program that prints out all the even numbers from 0 to 20. Print this list 4 times, using while, until, do-until and for loops.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    835
    Rep Power
    496
    Not sure that this is what your teacher is requesting, but a possible solution:

    Perl Code:
    while (0);
    do {} until 0;
    for (0..0) {};
    for (1..4) { print 2*$_, "\n", foreach (1..10);

IMN logo majestic logo threadwatch logo seochat tools logo