Write the code for finding the factorial of a passed integer. Use a recursive subroutine?
Submitted by: Administrator// BEGIN PERL SNIPET
sub factorial {
my $y = shift;
if ( $y > 1 ) {
return $y * &factorial( $y - 1 );
} else {
return 1;
}
}
// END PERL SNIPET
Submitted by: Administrator
sub factorial {
my $y = shift;
if ( $y > 1 ) {
return $y * &factorial( $y - 1 );
} else {
return 1;
}
}
// END PERL SNIPET
Submitted by: Administrator
Read Online Electrical Engineering Job Interview Questions And Answers
Top Electrical Engineering Questions
☺ | CO2 fire extinguishers are indicated by the color code |
☺ | In a star connected three phase transformer the |
☺ | A single-phase double-wound transformer consists of |
☺ | A residual current device will disconnect under |
☺ | The usual method of insulating core laminations is |
Top Best Engineering Categories
☺ | Mechanical Engineering Interview Questions. |
☺ | Civil Engineering Interview Questions. |
☺ | Chemical Engineering Interview Questions. |
☺ | Electrical Engineering Interview Questions. |
☺ | Automobile Engineering Interview Questions. |