MarcinKrol

Zad 14 - JS

Nov 24th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. const A = prompt('Podaj Podaj liczbę A:') * 1;
  2. const B = prompt('Podaj Podaj liczbę B:') * 1;
  3. const C = prompt('Podaj Podaj liczbę C:') * 1;
  4. const D = prompt('Podaj Podaj liczbę D:') * 1;
  5. const E = prompt('Podaj Podaj liczbę E:') * 1;
  6.  
  7.  
  8.  
  9. let sr = (a, b, c, d, e) => {
  10. let suma = (a+b+c+d+e);
  11. let srednia = suma/5;
  12. return srednia;
  13. }
  14.  
  15. let min = (...args) => {
  16. let minimum =Math.min(...args);
  17. return minimum;
  18. }
  19.  
  20. let max = (...args) => {
  21. let maximum = Math.max(...args);
  22. return maximum;
  23. }
  24.  
  25. document.write(`Średnia wynosi: ${sr(A, B, C, D, E)}<br>`);
  26. document.write(`Najmniejsza warość wynosi: ${min(A, B, C, D, E)}<br>`);
  27. document.write(`Największa wartość wynosi: ${max(A, B, C, D, E)}<br>`);
Advertisement
Add Comment
Please, Sign In to add comment