Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let index = 0;
- let jury = Number(input[index]);
- index++;
- let nameOfPrezentation = input[index];
- let command = "";
- let sum = 0;
- let commandN = 0;
- let total = 0;
- let counter = 0;
- while (command !== "Finish") {
- sum = 0;
- for (let i = 1; i <= jury; i++) {
- index++;
- command = input[index];
- commandN = Number(command);
- sum += commandN;
- }
- counter++;
- sum = sum / jury;
- total += sum;
- console.log(`${nameOfPrezentation} - ${sum.toFixed(2)}.`);
- index++;
- command = input[index];
- nameOfPrezentation = input[index];
- }
- total = (total / counter).toFixed(2);
- console.log(`Student's final assessment is ${total}.`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement