Addition & Cube Loop C program

Closed
vamp99
Posts
1
Registration date
Monday August 8, 2016
Status
Member
Last seen
August 8, 2016
- Aug 8, 2016 at 02:29 AM
Anybody can do this?

1. Write a program called sumk.c which, for each number k from 1 to 15, prints the sum of the numbers from 1 to k. Compile it to produce an executable called sumk. Your program should print a table in this format:
k sum
--------
1 1
2 3
3 6
4 10
etc.
Note: you might like to use a format such as "%4d" in your printf() statement, to force the sums to be right-justified.

2. Copy sumk.c to a new file sumcube.c . Modify the new file so that, for each integer k between 1 and 15, it prints the sum of the cubes of the numbers between 1 and k. Compile this program to produce an executable called sumcube. Note: you should change the number of digits in the format statement so the numbers remain right-justified.