write a script to check whether user enter a value is a
leap year or not?
Answer Posted / 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 |
Post New Answer View All Answers
List the prefix dereferencer in Perl.
What is the importance of perl warnings?
what are the steps involved in reading a cgi script on the server?
How to read file into hash array ?
What does the’$_’ symbol mean?
Which has the highest precedence, List or Terms? Explain?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?
Can you add two arrays together?
Mention what is cpan?
What is the purpose of redo statement?
How will you get the count of parameters passed to a perl subroutine?
How do you set environment variables in perl?
In Perl, what is grep function used for?
Explain the use of 'my' keyword in perl?