Search for question
Question

Perform the following commands in R

set. seed (10)

a = sample (1:100, 600, replace

TRUE)

(a) Find the number of occurrences of both 1 and 2 in a.

(b) Replace all occurrences of 1 in a with 2.

(c) Find the sum of odd numbers in a.

(d) Write a function that takes one positive number as a parameter a and finds

the sum of all numbers between 1 and a that are divisible by a.