Perhaps if you had
int grades[8];

instead of 8 separately named variables, you could sort the array, and the lowest would be at one end.