Created
January 22, 2022 22:17
-
-
Save CodeMaster7000/416f3947be408acf917a500b0d012731 to your computer and use it in GitHub Desktop.
A program in R to find the factors of a given number.
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
| print_factors <- function(x) { | |
| print(paste("The factors of",x,"are:")) | |
| for(i in 1:x) { | |
| if((x %% i) == 0) { | |
| print(i) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment