To calculate the CGPA, add the percentages of all semesters and divide it by the total number of semesters and then divide the result by 9.5.