Question: Create a function that will return the product of two integers. ```{r} prod -> ............. ............. } prod(3,4) ``` # Ex 6: Create a function

Create a function that will return the product of two integers. ```{r} prod -> ............. ............. }

prod(3,4) ```

# Ex 6: Create a function that accepts two arguments, an integer and a vector of integers. It returns TRUE if the integer is present in the vector, otherwise it returns FALSE. Make sure you pay careful attention to your placement of the return(FALSE) line in your function!

```{r} num_check -> ............. ............. }

num_check(2,c(1,2,3)) ```

# Ex 7: Create a function that accepts two arguments, an integer and a vector of integers. It returns the count of the number of occurences of the integer in the input vector. ```{r} num_count -> ............. ............. }

num_count(2,c(1,1,2,2,3,3)) ```

# Ex 8: We want to ship bars of aluminum. We will create a function that accepts an integer representing the requested kilograms of aluminum for the package to be shipped. To fullfill these order, we have small bars (1 kilogram each) and big bars (5 kilograms each). Return the least number of bars needed.

```{r} bar_count -> ............. ............. }

bar_count(6) bar_count(17) ```




Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!