Headlines
Loading...
Program in UNIX to check entered year is leap year or not

Program in UNIX to check entered year is leap year or not

Write a shell script to check entered year is leap year or not
echo "enter a year"
read y 

if [ `expr $y % 4` -eq 0 ]
then
if [ `expr $y % 400` -eq 0 -o `expr $y % 100` -ne 0 ]
then
echo "$y is a leap year"
else
echo "$y is not a leap year"
fi
else
echo "$y is not a leap year"
fi
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***