Given three integers j, k and m
Build a function (in any development language) called SeqSummation, that calculates the sequence of summation as per:
j + (j + 1) + (j + 2) + (j + 3) + … + k + (k − 1) + (k − 2) + (k − 3) + … + m
Explanation: increment from j until it equals k, then decrement from k until it equals m.
Function Description
Create the function SeqSummation.
SeqSummation takes the following parameter(s):
• j integer
• k integer
• m integer
Program Output
• the value of the sequence sum
Example
• SeqSummation (5,9,6)
• i = 5, j = 9, k = 6
• Sum all the values from i to j and back to k: 5 + 6 + 7 + 8 + 9 + 8 + 7 + 6 = 56.
• Output: 56
Answers
Answered by
0
Answer:
I wish I can help you can i
Similar questions
English,
12 hours ago
Accountancy,
12 hours ago
Accountancy,
12 hours ago
Hindi,
8 months ago
Hindi,
8 months ago
Hindi,
8 months ago