How to Calculate a Multiplication Table in R (Example Code)

This tutorial shows how to calculate and construct a multiplication table in R.

Example: Construct a Multiplication Table

my_num <- 4                          # Specify number for multiplication
for(i in 1:10) {                     # Create multiplication table
  print(paste(my_num, "*", i, "=", my_num * i))
}
# [1] "4 * 1 = 4"
# [1] "4 * 2 = 8"
# [1] "4 * 3 = 12"
# [1] "4 * 4 = 16"
# [1] "4 * 5 = 20"
# [1] "4 * 6 = 24"
# [1] "4 * 7 = 28"
# [1] "4 * 8 = 32"
# [1] "4 * 9 = 36"
# [1] "4 * 10 = 40"

Further Resources & Related Articles

In addition, you might have a look at some of the other tutorials on my homepage. Some related articles that are related to the construction of a multiplication table are listed below:

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top