Interviewer And Interviewee Guide

Electrical Engineering Interview Question:

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

Read Online Electrical Engineering Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.