Saturday, 8 March 2014

Unix program to find whether the given year is leap year or not?


Unix  program to find whether the given year is leap year or not?

program
clear
echo "enter the year"
read year

if [ `expr $year % 4` -eq 0 ]
then
echo "$year is leap year"
else
echo "$year is not leap year"
fi


OutPut
enter the year
2010

2010 is not leap year
enter the year
2011

2011 is not leap year

No comments: