Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use r studio and provide the code. Part3) Functions - 20 points Using a for loop or a while loop, write your own Fl

please use r studio and provide the code.

image text in transcribed
Part3) Functions - 20 points Using a for loop or a while loop, write your own Fl function, sum_of_first_N_odd_squares (n), that returns the sum of the squares of the first n odd numbers. For example, if n = 5, the first five odd numbers are 1, 3, 5, 7, 9 and the required result is 12+32+52+72+92=165 Test your function as follows: > sum_of_first_N_odd_squares(2) [1] 10 > sum_oF_First_N_odd_squaresC5) [1] 165 > sum_of_First_N_odd_squares(10) [1] 1330 Now, without using any loop, write your own Fl function, sum_of_first_N_odd_squares_V2 (n), that returns the sum of the squares of the first n odd numbers. Test your function as follows: > sum_of_first_N_odd_squares_V2(2) [1] 19 > sum_of_first_N_odd_squares_V2(5) [1] 165 > sum_of_ftrst_N_odd_squares_V2(1@) [1] 1330

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

6. What are debt service exports?

Answered: 1 week ago

Question

Have pattern like hair on their skin?

Answered: 1 week ago