write a script to check whether user enter a value is a
leap year or not?
Answers were Sorted based on User's Feedback
Answer / sourisengupta
#call this function by passing the year....
sub isLeapyear
{
$year=shift;
if($year%4==0){
if($year%100==0){
if($year%400==0)
return 1;
return 0;
}
return 1;
}
}
| Is This Answer Correct ? | 14 Yes | 2 No |
Answer / subhash chandran
#The logic is that the year is either divisible by both
100 and 4 , OR its only divisible by 4 not by hundred
if($Year%400 == 0 || ($Year%100 != 0 && $Year%4 == 0))
{
print "Leap year \n";
}
else
{
print "Not Leap \n";
}
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / sourisengupta
#call this function by passing the year....
sub isLeapyear
{
$year=shift;
if($year%4==0){
if($year%100==0){
if($year%400==0)
return 1;
return 0;
}
return 1;
}
}
| Is This Answer Correct ? | 7 Yes | 2 No |
Explain substr function in perl?
what is the difference b/w coldfusion MX 6 and Coldfusion MX 7?
Write the program to process a list of numbers.
What are the different string manipulation operators in perl?
How are parameters passed to subroutines in perl?
What does redo statement do in perl?
What is the main function of cookie server?
how to extract pin_code,phone_number,year from text file using regular expressions in perl
If you want to empty an array then how would you do that?
What exactly is grooving and shortening of the array?
Name an instance where you used a CPAN module?
Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?