Perl
Ads
Perl Q: Write the code for finding the factorial of a passed integer. Use a recursive subroutine. A: // BEGIN PERL SNIPET sub factorial { my $y = shift; if ( $y > 1 ) { return $y * &factorial( $y - 1 ); } else { return 1; } } // END PERL SNIPET Q: Given $a = "5,-3,7,0,-5,12"; Write a program to find the lowest number in the string. A: // BEGIN PERL SNIPET $a = "5,-5,-1,0,12,-3"; (@temp) = split (/,/, $a); $lowest = $temp[0]; for ($i=0; $i<6; $i++) { if ($temp[$i] < $lowest) { $lowest = $temp[$… More information...
| User: | Saurabh Dayal |
|---|---|
| Page: | vlsiquestions.webnode.com (?) |
Ads
Build your Free Website!
- 100% free
- In only 5 min
- Your own domain
- No Ads
- No installation
- No technical skills

