Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
Created January 22, 2022 22:25
Show Gist options
  • Select an option

  • Save CodeMaster7000/b413193c5304fc7423c041de7de65d5b to your computer and use it in GitHub Desktop.

Select an option

Save CodeMaster7000/b413193c5304fc7423c041de7de65d5b to your computer and use it in GitHub Desktop.
A program in R which checks in the input year is a leap year or not.
year = as.integer(readline(prompt="Enter a year: "))
if((year %% 4) == 0) {
if((year %% 100) == 0) {
if((year %% 400) == 0) {
print(paste(year,"is a leap year"))
} else {
print(paste(year,"is not a leap year"))
}
} else {
print(paste(year,"is a leap year"))
}
} else {
print(paste(year,"is not a leap year"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment