Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2. Recursion Sum (60 points) A Summation formula is defined as: sum(n, k) no + n1 + n2 + + nk ;for example: .

image text in transcribed

Question 2. Recursion Sum (60 points) A Summation formula is defined as: sum(n, k) no + n1 + n2 + + nk ;for example: . Write a C program to ask user input a decimal n and an integer k and return a correct summation following the formula defined above. The C program is required to use Recursion function (a function calling itself) to achieve this purpose. At least, when calculating some power of n, you are required to use Recursion to evaluate the power of n. Name your file Hw3_q2_code.c Hint: write a pow function with recursion method learned from the textbook or instructor's Ch4 slides (Not allowed to use pow in math.h library) and test it function well. Example inputs: Please input n-6.5 Please input k = 5 Example Output: Sum = 13712.34375. please input n = 10 please input k-4 Sum = 11111-000000 please input n6.5 please input k = 5 um 13712.343750

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago

Question

8. Providing support during instruction.

Answered: 1 week ago