Question: Enter a C program to print a list of values, each value being the sum of all integers from 1 to n. The first three

Enter a C program to print a list of values, each value being the sum of all integers from 1 to n. The first three lines of the output would be:

sum[1] = 1

sum[2] = 3

sum[3] = 6

So the first line shows the sum of all integers from 1 to 1, which is 1.

The second line shows the sum of all integers from 1 to 2, which is 1 + 2 = 3

The third line shows 1 + 2 + 3 = 6.

Your program should print all of the sums from 1 to 10. Your program should use a loop. In your answer, you do not have to have the #include, or the 'int main(...)', just show any variable declarations and assignments, and the loop.

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!