Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save CodeMaster7000/416f3947be408acf917a500b0d012731 to your computer and use it in GitHub Desktop.
A program in R to find the factors of a given number.
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