Ab_georgi

Untitled

Nov 29th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.     let name = input.shift()
  3.  
  4.     let obshto = 0
  5.     let n = 0
  6.  
  7.     while (n < 12) {
  8.         let sum = Number(input.shift())
  9.         obshto += sum
  10.         n++
  11.     }
  12.     if (obshto >= 4) {
  13.         console.log(`${name} graduated. Average grade: ${(obshto / 12).toFixed(2)} `)
  14.     }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment