Loading…
OS · Decisions · Program 17 · In the record
Write the shell script to input a year and check whether it is leap year or not
1#!/bin/bash2 3echo "Enter a year:"4read y5 6if (( (y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ))7then8 echo "$y is a Leap Year"9else10 echo "$y is not a Leap Year"11fi2024Enter a year: 2024 2024 is a Leap Year
Run program 17 in your browser
bash · just-bash. Change the code or the input, run it, break it, and see what happens.