R Multiplication Table Tutorial

Here is an example code in R language for writing a multiplication table up to 99.

for(i in 1:9) {
  for(j in 1:9) {
    result <- i * j
    cat(paste(i, "x", j, "=", result), "\t")
  }
  cat("\n")
}

This code utilizes two nested for loops, with the outer loop controlling the number of rows in the multiplication table and the inner loop controlling the number of columns. By calculating the product of the current row and column, the result is printed out and separated by tabs \t. After each row is completed, a new line is created using a line break \n.

By running the above code, you will be able to output the results of the 99 multiplication table.

bannerAds