Thursday, May 1, 2008

Any year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators -a and -o.

# SS14

# Script to determine whether a year is leap or not

# Usage: SS14

echo enter year

read year

if [ ‘expr $year %400‘ -eq 0 \) -o \(‘expr $year % 100‘ -ne 0 -a ‘expr
$year %4‘ -eq 0 \)]

then

echo $year is a leap year

else

echo $year is not a leap year

fi

No comments: