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.
change line
Console.WriteLine("Result: " + SeqSummation(a,b,c));
to next:
Console.WriteLine("Result: " + SeqSummation(j,k,m));
Comments
Leave a comment