Question 2 Not complete Marked out of 2.00 Flag question The series of pentagonal numbers can be defined recursively as

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 2 Not complete Marked out of 2.00 Flag question The series of pentagonal numbers can be defined recursively as

Post by answerhappygod »

Question 2 Not Complete Marked Out Of 2 00 Flag Question The Series Of Pentagonal Numbers Can Be Defined Recursively As 1
Question 2 Not Complete Marked Out Of 2 00 Flag Question The Series Of Pentagonal Numbers Can Be Defined Recursively As 1 (140.17 KiB) Viewed 13 times
For example:
code:
int pentagonal_numbers(int n){

}
Question 2 Not complete Marked out of 2.00 Flag question The series of pentagonal numbers can be defined recursively as follows: if n=1 Pn = if n = 2 Pn-1-Pn-2+3 otherwise Complete the definition of the pentagonal_numbers() function which takes a single integer parameter n and returns the nth pentagonal number (an integer). You can assume that n will be 1 or more. The pentagonal_numbers () function must be defined recursively. Some examples of the function being called are shown below. For example: Test Result int n = 1; pentagonal_numbers (1) = 1 printf("pentagonal_numbers (%d) = %d\n", n, pentagonal_numbers(n)); int n = 2; pentagonal_numbers (2) = 5 printf("pentagonal_numbers (%d) = %d\n", n, pentagonal_numbers (n)); int n = 3; pentagonal_numbers (3) = 12 printf("pentagonal_numbers (%d) = %d\n", n, pentagonal_numbers (n)); Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1vint pentagonal_numbers (int n){ 2 3}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply