Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. # include <iostream>
  2. # include <cstdio>
  3.  
  4.  
  5. using namespace std;
  6. double Suma(double tab[], int x){
  7. double sum = 0;
  8.        for(int i=0; i <x; i++)
  9.  
  10. {
  11.     sum += tab[i];
  12.    
  13. }
  14.  return sum;
  15. }
  16. int F(double*tab, int x){
  17. int a=0, i=0;
  18. double srednia;
  19.     double b = Suma( tab, x);
  20.     srednia = b/x;
  21.     cout << srednia << endl;
  22.     do
  23.     {
  24.          if (srednia>tab[i])
  25.          a++;  
  26.          i++;
  27.          } while (i<x);
  28.          return a;
  29. }
  30.  
  31. int main()
  32. {
  33.    double tab[] = {4,7,2,7,6};
  34.     cout << F(tab,5)  << endl;
  35.     system ("pause");  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement