Find Leap Year in Bash shell programming in LINUX UNIX Operating System

Bash shell program it uses the chk variable if it is divided by 4 is equl to zero then it is leap year or it is not leap year.
Source code bash shell Programming Algorithm
echo “Enter the year”
read year
chk=`expr $year % 4`
if [ $chk –eq 0 ]
then
echo “ $year is a leap year ”
else
echo “ $year is a not leap year ”
fi


Find LEAP YEAR OUTPUT CS1252 Operating Systems lap
[redhat35@localhost Rhel5]$
Enter the year
1995
year is not leap year


[redhat35@localhost Rhel5]$
Enter the year
1998
year is leap year

Related post