Code to print student result works correctly