Ab_georgi

Untitled

Nov 29th, 2019
874
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 counter = 0
  6.  
  7.     while (counter < 12) {
  8.         let sum = Number(input.shift())
  9.         obshto += sum
  10.         counter++
  11.     }
  12.     obshto = obshto / 12
  13.     if (obshto >= 4) {
  14.         console.log(`${name} graduated. Average grade: ${obshto.toFixed(2)} `)
  15.     }
  16.  
  17. }
  18. solve(["Ani",
  19.     5,
  20.     5.32,
  21.     6,
  22.     5.43,
  23.     5,
  24.     6,
  25.     5.5,
  26.     4.55,
  27.     5,
  28.     6,
  29.     5.56,
  30.     6,
  31.     ])
Advertisement
Add Comment
Please, Sign In to add comment