 # R Program to find sequence,sum and mean of given numbers

## How to find sequence, sum and mean

Here we are explaining how to write an R program to find the sequence, sum, and mean of the given numbers. Here we are using built-in functions seq, mean, sum for this calculation. The numbers are passed to these functions directly here. To generating regular sequences seq is a standard generic with a default method. Whereas sum returns the sum of all the values present in its arguments. The sum of the values dividing with the number of values in a data series is calculated using the mean function.

``````seq(from, to)
sum(…, na.rm = FALSE)
mean(x, trim = 0, na.rm = FALSE, ...)

```
```

## How sequence, sum and mean of numbers is calculated in R Program

Given below are the steps which are used in the R program to find the sequence, sum and mean of numbers. In this R program, we directly give the values to built-in functions. And print the function result.

## ALGORITHM

STEP 1: Use the built-in functions

STEP 2: call `seq()` with two values from and to specifying the limit of sequence values

STEP 3: call `mean()` with two values from and to specifying the limit of numbers

STEP 4: call `sum()` with two values from and to specifying the limit of numbers

STEP 5: print the result of each functions

## R Source Code

```                                          ```print("Sequence of numbers from 20 to 40:")
print(seq(20,40))
print("Mean of numbers from 20 to 60:")
print(mean(20:60))
print("Sum of numbers from 51 to 91:")
print(sum(51:91))
```
```

## OUTPUT

``` "Sequence of numbers from 20 to 40:"
 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
 "Mean of numbers from 20 to 60:"
 40
 "Sum of numbers from 51 to 91:"
 2911```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 