Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = [
- "3",
- "4",
- "1",
- "2"
- ];
- let print = this.print || console.log;
- let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- let n = +gets();
- var sum = 0;
- let arr = [] ;
- for (let i = 0 ; i < n ; ++i)
- {
- arr.push( +gets() );
- }
- let max = Math.max.apply(null,arr);
- let min = Math.min.apply(null,arr);
- print(`min=${min.toFixed(2)}`);
- print(`max=${max.toFixed(2)}`);
- for(let i = 0; i < n ; i++)
- {
- sum = sum + arr[i];
- }
- print(`sum=${sum.toFixed(2)}`);
- print(`avg=${(sum/n).toFixed(2)}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement