• + 3 comments

    I did this with backward iteration and without your most inner If:

    for(int i = grades.Length-1; i >=0; i--)
                {
                    if(grades[i] >= 38 && grades[i] % 5 >2)
                    {
                        grades[i] = grades[i] + (5 - (grades[i] % 5));
                    }
                }