Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is R language 2.1. Define and write a function which takes one number as input and detects whether the number is even. Return TRUE

image text in transcribedThis is "R" language

2.1. Define and write a function which takes one number as input and detects whether the number is even. Return TRUE if it is even, and FALSE otherwise. You need to first not, return NA detect if the input is an integer if Note 1: TRUE and FALSE are logical values, not strings! Note 2: No need to get user input from the console. Test your function using your_function_name (1), your_function_name (2), and your function name (1.5) Hint: What is the definition of even numbers? In R, you can get the remainder after division using the %% operator (a.k.a. the modulus operator). Example: 5 %% 3 # get the remainder after dividing 5 by 3 2.2. Write a for loop to get the sum of all the even numbers from -50 to 50. You have to use the function you wrote from the above task

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions