Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double findAvarage(int a[], int n)
- {
- int sum = 0;
- for (int i=0; i<n; i++)
- sum += a[i];
- return (double)sum/n;
- }
- int main()
- {
- int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9,10};
- int n = sizeof(arr)/sizeof(arr[0]);
- cout << findAvarage(arr, n) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement