simple grade alg with avg, sum :
swift code (run at swift online IDE : http://online.swiftplayground.run/)

Code:

import Foundation

var grades = [10, 20, 30, 40,50,60,70,80,100,100]
var students = ["one","two","three","four","five","roku","shichi","hachi","kyuu","juu"]
let fail = 55
var sum=0
var max = 0
 print(grades.count)
for idx in 0...grades.count-1
 {
    sum+=grades[idx]
    if max <= grades[idx] {max = grades[idx]}
    if grades[idx] < fail {print("\(students[idx]) has failed")}
 }
 var avg = sum/grades.count
 print("avg grade : \(sum/grades.count)")
 print("highest ranking students :")
for idx in 0...grades.count-1
{
  if max == grades[idx] {print(students[idx])}
}
print("below avg :")
for idx in 0...grades.count-1
{
  if avg > grades[idx] {print(students[idx])}
}



out put :


Code:

10
one has failed
two has failed
three has failed
four has failed
five has failed
avg grade : 56
highest ranking students :
kyuu
juu
below avg :
one
two
three
four
five
works :frustration: