آیا سال معین شده سال کبیسه است یا خیر
Program :- To find whether the given year is leap year or not.
echo Enter the year
read yy
a=`expr $yy % 4`
b=`expr $yy % 100`
c=`expr $yy % 400`
if [ $a -eq 0 -a $b -ne 0 -o $c -eq 0 ]
then
echo $yy is leap year
else
echo $yy is not a leap year
fi
Output 1:
Enter the year
۲۰۰۴
۲۰۰۴ is leap year
Output 2:
Enter the year
۲۰۰۶
۲۰۰۶ is not a leap year