Question: IN C++ An arithmetic progression (AP) is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, 5, 7,

IN C++

An arithmetic progression (AP) is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, 5, 7, 9, 11, 13, 15, . . . is an arithmetic progression starting at 5 with common difference of 2. Write a function named arithProg that takes an array size (n), a start value and the difference that returns a dynamically allocated array containing the first n values in the arithmetic progression starting at start, with the provided difference. Write a main function to demonstrate your function. Assume the input will be a size, start value and difference. The output should be the elements of the new array. Be sure to deallocate any dynamically allocated memory! If the input is 5 2 3 the output should be 2 5 8 11 14 If the input is 9 1 2 the output should be 1 3 5 7 9 11 13 15 17

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!