private string getTest3(string subid) { int countTest1 = 0; List <Mark> listMark = SubjectDAO.getListMarks(subid); foreach (var i in listMark) { if (i.Test3 >= 5) { countTest1++; } } float percent = 0; try { percent = countTest1 * 100 / count; } catch (Exception ex) { } return(percent + "%"); }