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 ]
echo “ $year is a leap year ”
echo “ $year is a not leap year ”

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

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

No comments:
Write comments