• + 0 comments

    /* -------- With C# -------- */

    public static List<int> gradingStudents(List<int> grades)
    {
        List<int> newGrade =new List<int>();
    
        foreach(var grade in grades)
        {
            if(grade < 38) newGrade.Add(grade);
    
            else if(grade >=38)
            {
                int testN = 0;
                testN =((grade + 4)/5) * 5 ;
    
                if((testN - grade) <3)
                {
                    newGrade.Add(testN);
                }
                else
                {
                    newGrade.Add(grade);
                }
            }  
        }
        return newGrade;
    }