Page MenuHomec4science

exercise01-6.cpp
No OneTemporary

File Metadata

Created
Sat, Jul 5, 02:34

exercise01-6.cpp

/*
* exercise-template.cpp <--- The name of the source file goes here
*
* <--- Description of the program goes here.
*
* Created on: September 02, 2015 <--- Fill in the date here
* Author: Davide Forti <davide.forti@epfl.ch> <--- Fill in your name (and e-mail) here
*/
/*
* Any headers you need to include should be specified on the next lines
*/
#include <iostream>
#include <cmath>
int main(int argc, char* argv[])
{
int D[5] = {34, 58, 57, 32, 43};
int L = sizeof(D)/sizeof(*D);
int sum;
double mean;
for (int i=0; i<L; i++)
{
sum += D[i];
}
mean = double(sum)/double(L);
std::cout << "The average of theses number is " << mean << ". \n";
}

Event Timeline