Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- cout << "Ile liczb chcesz wprowadzic?\n";
- int N;
- cin >> N;
- float sum = 0;
- cout << "Dobra. To pisz\n";
- float array[N];
- for(int i=0; i<N; i++){
- cin >> array[i];
- sum = sum + array[i];
- }
- float avg = sum / N;
- float sum2 = 0;
- cout << "Ilosc danych:\t\t\t" << N << endl;
- cout << "Wprowadzone dane:\n";
- for(int i=0; i<N; i++){
- cout << "\t\t\t\t" << array[i] << endl;
- sum2 = sum2 + (array[i] - avg)*(array[i] - avg);
- }
- cout << endl << "Srednia:\t\t\t" << avg << endl;
- cout << "Odchylenie standardowe:\t\t" << sqrt(sum2/N) << endl;
- return 420;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement