Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double srednia(double* tablica, int wielkosc)
- {
- double wartosc = 0;
- for(int i = 0; i < wielkosc; ++i)
- wartosc = wartosc + tablica[i];
- return wartosc / wielkosc;
- }
- int main()
- {
- double tablica[5] = {1, 3.2, 5.1, -0.2, 0.97};
- cout << srednia(tablica, 5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement