Created
January 22, 2022 22:25
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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