I want my subroutine to calculate the tables of 2,3,4 and display them in separate lines.I made a subroutine called "table" and passed 2,3,4 as parameter.But I am getting the table of 2 only and not 3 and 4.Below is my code.Please check and let me know.
use strict; use warnings; use diagnostics; use 5.01000; &table(2,3,4); sub table{ my $i = 1; my $loop; foreach $loop(@_){ for($i;$i<=10;$i++){ my $ans = $i*$loop; print"$ans "; } print"\n"; } }
In reply to subroutine to calculate multiplication tables by Thakur
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |