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
When does circular reference occur?
How do you you check the return code of a command in perl?
Explain splicing of arrays?
What does undef function in perl?
How do I sort a hash by the hash value?
How do I replace every TAB character in a file with a comma?
what are the two ways to get private values inside a subroutine or block?
How many data types are there in perl?
what is perl language?
How will you open a file in a write-only mode in perl?
Why Perl aliases are considered to be faster than references?
What does init 5 and init 0 do?
How to merge two arrays in perl?
What are the arguements we normally use for perl interpreter?
List the prefix dereferencer in Perl.