daily pastebin goal
33%
SHARE
TWEET

Übung 7-03

a guest Mar 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int n = 3;
  6. double a[n];
  7. double avg (double a[n]);
  8.  
  9. int main()
  10. {
  11.     double b[n];
  12.     int i = 0;
  13.     for (; i < n; i++){
  14.         cin >> b[i];
  15.     }
  16.     cout << avg(b)<< endl;
  17. }
  18.  
  19. double avg (double a[n]){
  20.     int i = 0;
  21.     double x = 0;
  22.     for (; i < n; i++){
  23.         x += a[i];
  24.     }
  25.     x = x /n;
  26.     return x;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top