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 does polymorphism work in perl?
Explain ivalue?
Why aren't Perl's patterns regular expressions?
How to access parameters passed to a subroutine in perl?
Explain the execution of a program in perl.
Who created perl?
Explain the meaning of perl one-liner?
What does delete function do in perl?
Where do we require ‘chomp’ and what does it mean?
What is boolean context?
Explain what is STDIN, STDOUT and STDERR?
What is chomp() operator/function?
What are the various file operations in perl. Explain with example.
How to turn on Perl warnings? Why is that important?
What is the importance of perl warnings?