Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc;
- clear;
- n=input('Podaj ile liczb chcesz dodać: ');
- suma=0;
- while round(n)~=n || n<0
- n=input('Zła wartość. Podaj ponownie wartość n: ');
- end
- for i=1:n;
- k(i)=input(['Podaj liczbę k', num2str(i), ': ']);
- suma=sum(k);
- end
- g=suma/n;
- disp(['Średnia wynosi = ', num2str(g)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement