Advertisement
IoGi

Max Min

Feb 7th, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let number = 3;
  2. let input = [
  3.   2,
  4.   -1,
  5.   4,
  6. ];
  7.  
  8. //let numberGets = + gets();
  9. let total = 0;
  10.  
  11. for (let i = 0; i < input.length; i++) {
  12.     total += input[i];
  13. }
  14. console.log('min=' + (Math.min(...input).toFixed(2)));
  15. console.log('max=' + (Math.max(...input).toFixed(2)));
  16. console.log('sum=' + total.toFixed(2));
  17. console.log('avg=' + (total / number).toFixed(2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement