R Programming: Divide two vectors of integers type and length 3
R Programming: Vector Exercise-5 with Solution
Write a R program to divide 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 dividing Vectors:")
z = x / y
print(z)
Sample Output:
[1] "Original Vectors:" [1] 10 20 30 [1] 20 10 40 [1] "After dividing Vectors:" [1] 0.50 2.00 0.75
R Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a R program to multiply two vectors of integers type and length 3.
Next: Write a R program to find Sum, Mean and Product of a Vector.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics