#include<stdio.h>

/**
 * Terry Harvey CIS 105 Section 010 TA Tina Weymouth
 *  Demonstration program to sum elements in an array
 **/

int main(){
    int i;
    double halves[10];
    double sum = 0;

    for(i = 0; i < 10; i++){
	//explain why a unary type cast is better style than dividing
	//by 2.0
        halves[i] = (double)i / 2;
    }

    for(i = 0; i < 10; i++){
        printf("%lf\n", halves[i]);
    }
    
    //sum the elements in the array

    for(i = 0; i < 10; i++){
	sum = sum + halves[i];
	//printf("sum so far is %lf\n", sum);
    }

    printf("Sum is %lf\n", sum);

    return 0;

}


