From 97a693d996c79fb2a008b19750d8bb45512e01a2 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 6 Feb 2017 11:26:44 -0500 Subject: Inital commit --- mean.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 mean.c (limited to 'mean.c') diff --git a/mean.c b/mean.c new file mode 100644 index 0000000..34ec21c --- /dev/null +++ b/mean.c @@ -0,0 +1,26 @@ +/* File: mean.c + Calculate the mean value for the elements in an array */ + +#include + +#define N 8 + +int main() +{ + /*Declare array a with initialization */ + double a[N] = {3.0,21.0,0.0,-3.0,34.0,-14.0,45.0,18.0}; + double sum, + meanval; + + int i; + + sum = 0; + + for(i=0;i