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
How do I sort a hash by the hash key?
Explain splicing of arrays?
What are the logical operators used for small scale operations?
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 ?
For a situation in programming, how can you determine that Perl is a suitable?
How can information be put into hashes?
Explain the functioning of conditional structures in perl.
Explain the difference between "my" and "local" variable scope declarations. ?
What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?
Enlist the advantages of using c over perl?
Explain gmtime() function in perl?
How to read a file into a hash array?
You want to download the contents of a url with perl. How would you do that?
How do I send e-mail from a Perl/CGI program on a Unix system?
Explain ivalue?