on-internet
← Community

How to make this program print in descending order?

Stack Overflow ·

This code runs, but it prints in ascending order. Do I need to change my whole formula? print "Enter an integer \n"; my $root = <STDIN>; my @nums = (100 .. 200); my $i = 0; # code in while loop executes as long as condition is true while ( $i < $#nums ) { print "$nums[$i]\n", if ($nums[$i] % $root == 0); $i++; }

Comments

Sign in or sign up to comment and upvote.

No comments yet.