Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- float srednia (float *wsk, int howmany)
- {
- float suma = 0;
- for (int i=0; i<howmany; i++)
- {
- suma = suma+*wsk;
- wsk++;
- }
- return suma/howmany;
- }
- int main()
- {
- float ile, liczba[300];
- float suma = 0;
- cout << "Podaj ile liczb chcesz wpisac: " << endl;
- cin >> ile;
- cout << "Podaj " << ile <<" liczb: ";
- for (int i=0; i<ile; i++)
- {
- cin >> liczba[ile];
- suma = suma+liczba[ile];
- }
- cout << "Suma to: " << suma << " a srednia to: " << srednia(liczba, ile);
- }
Advertisement
Add Comment
Please, Sign In to add comment