By DePaul Dimadis
Choose your prefered Language: greek_flag uk_flag

Enter values ​​in a one-dimensional array of positive integers in the range [1-99], N (N = known and even). Numbers can be entered in any way (scanf_s command, using random number creation function), provided that a valid validity check is in place.
Consider that you are also given:

A given known value t, 0  a known upper limit M.
The program, in C language, will create a new table that will include the sums of the elements in the original table starting from positions 1, 2, 3, ... N and spacing t. If the process reaches or exceeds the end of the table, it will continue from the beginning until the sum exceeds the M.

Example. Original array, N = 10, t = 4, M = 200:

14 7 91 27 53 72 18 52 33 44


Sums:

1st Sum: 14 + 53 + 33 + 91 + 18 = 209

2nd sum: 7 + 72 + 44 + 27 + 52 = 202

New Array:

209 202 ... ...