Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions