C: sum 1 to 10 using a loop

/* print 1 to 10 to screen using loop

to compile,

gcc task1_sum_1to10_do_loop.c

*/

#include <stdio.h>

int main(void) {

int indx;

int sumd;

sumd=0;

for (indx = 1; indx <= 10; indx++)

{

printf ("%d\n", indx);

sumd=sumd+indx;

}

printf ("sum=%d\n", sumd);

return 0;

}