Wednesday, 17 April 2019

Write a shell script to find a year is leap year or not.

Write a shell script to find a year is leap year or not.


echo "Enter Year:"
read y

year=$y

y=$(( $y % 4 ))
if [ $y -eq 0 ]
then
          echo "$year is Leap Year!"
else
          echo "$year is not a Leap Year!"
fi

Output:

Enter Year:
2019
2019 is not a Leap Year!

No comments:

Post a Comment