Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- using namespace std;
- double getAverage(int* arr, int size)
- {
- double answer = 0.0;
- for(int i = 0; i < size; i++)
- answer += arr[i];
- return answer / size;
- }
- int main()
- {
- const int SIZE = 5;
- int array[SIZE];
- for(int i = 0; i < 5; i++)
- cin >> array[i];
- cout << getAverage(array, SIZE);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment