R Programming: Add two vectors of integers type and length 3
R Programming: Vector Exercise-2 with Solution
Write a R program to add two vectors of integers type and length 3.
Sample Solution :
R Programming Code :
x = c(10, 20, 30) y = c(20, 10, 40) print("Original Vectors:") print(x) print(y) print("After adding two Vectors:") z = x + y print(z)
 "Original Vectors:"  10 20 30  20 10 40  "After adding two Vectors:"  30 30 70
R Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a R program to create a vector of a specified type and length. Create vector of numeric, complex, logical and character types of length 6.
Next: Write a R program to append value to a given empty vector.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook