Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

leap year program in shell

#!/bin/bash
echo "Program to check for leap year or not"
read -p "Enter the year: " year
if [ $((year%400)) -eq 0 ]
then
        echo "$year is a leap year"
elif [ $((year%100)) -eq 0 ]
then
        echo "$year is not a leap year"
elif [ $((year%4)) -eq 0 ]
then
        echo "$year is a leap year"
else
        echo "$year is not a leap year"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: sed replace all occurances? 
Shell :: enable rpm fusion 
Shell :: unrachive .tar.gz 
Shell :: git resolve conflict using theirs 
Shell :: volume buttons not working ubuntu 18.04 
Shell :: ng command not found 
Shell :: shell strip quotes 
Shell :: change file name in terminal 
Shell :: install github cli debian 
Shell :: linux show ssh users 
Shell :: rmdir directory not empty windows 
Shell :: format partition linux 
Shell :: laravel installation from github 
Shell :: get size of image linux 
Shell :: react route install 
Shell :: ubuntu command to check all network interfaces with IPv4 
Shell :: configure editor for git 
Shell :: ssh login windows 
Shell :: npm http server 
Shell :: composer global install 
Shell :: node sass generate css 
Shell :: ifconfig not found 
Shell :: run jar file on the background on ubuntu 
Shell :: how to install lua on ubuntu 
Shell :: github activity graph 
Shell :: git stash drop 
Shell :: git checkout previous commit HEAD 
Shell :: edit file as root ubuntu 
Shell :: free todo linux 
Shell :: git unsafe repository 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =