Getting Multiplication of the Objects passed as Arguments in R Language – prod() Function

** prod()** function in R Language is used to return the multiplication results of all the values present in its arguments.

Syntax:prod(…)

Parameters:…:numeric or complex or logical vectors

**Example 1:**

`# R program to illustrate` `# prod function` ` ` `# Initializing some vectors of element` `x <` `-` `c(` `1` `, ` `2` `, ` `3` `, ` `4` `)` `y <` `-` `c(` `0` `, ` `2` `, ` `4` `, ` `6` `)` `z <` `-` `c(` `2.6` `, ` `3.7` `, ` `1.9` `)` ` ` `# Calling the prod() function` `prod(x) ` `# 1 × 2 × 3 × 4 ` `prod(y)` `prod(z)` |

**Output:**

[1] 24 [1] 0 [1] 18.278

**Example 2:**

`# R program to illustrate` `# prod function` ` ` `# Calling the prod() function` `prod(` `1` `:` `3` `) ` `# 1 × 2 × 3` `prod(` `0` `:` `8` `)` `prod(` `2` `:` `6` `)` |

**Output:**

[1] 6 [1] 0 [1] 720