inst/resources/scripts/nfact1.r

# program: spuRs/resources/scripts/nfact1.r
# Calculate n factorial

# clear the workspace
rm(list=ls())

# Input
n <- 6

# Calculation
n_factorial <- 1
for (i in 1:n) {
    n_factorial <- n_factorial * i
}

# Output
show(n_factorial)

Try the spuRs package in your browser

Any scripts or data that you put into this service are public.

spuRs documentation built on May 2, 2019, 12:44 p.m.