Created
August 25, 2018 02:27
-
-
Save sifue/ba14cb05038cda8f8074180c0fe111d3 to your computer and use it in GitHub Desktop.
average.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
double average(int AVR[], int N) { | |
double sum = 0; | |
for (int i = 0; i < N; i++) { | |
sum += AVR[i]; | |
} | |
double answer = sum / N; | |
return answer; | |
} | |
int main() { | |
int AVR[6] = {1, 2, 3, 4, 5, 6}; | |
cout << average(AVR, 6) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment