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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started