
Magic Squares


Consider the 10 first integers (1-10) in a row with a series number i = 1. The next row
includes 10 integers which are consecutive integer numbers starting from the i + 1 number
of the immediately preceding row. The rows are generated repeatedly until the sum of the
elements located in the i position of each row exceeds a given value n (n = known, given as constant
at the beginning of the algorithm or program).Example if n=30 the following lines are created:
i=1 1 2 3 4 5 6 7 8 9 10
i=2 2 3 4 5 6 7 8 9 10 11
i=3 4 5 6 7 8 9 10 11 12 13
i=4 7 8 9 10 11 12 13 14 15 16
i=5 11 12 13 14 15 16 17 18 19 20
The sum of 1 + 3 + 6 + 10 + 15 = 35 is greater than n = 30 and the repeat is stopped.
Write a C language program that will find and display these rows. Finally, the final sum of the items shown should be displayed.