<?php
// Test script to verify grade calculation functions

function calculateSubjectGrade($obtained_marks, $full_marks, $pass_marks) {
    // If student didn't obtain minimum passing marks, grade is F
    if ($obtained_marks < $pass_marks) {
        return 'F';
    }
    
    // Calculate percentage
    $percentage = ($full_marks > 0) ? ($obtained_marks / $full_marks) * 100 : 0;
    
    if ($percentage >= 80) return 'A+';
    elseif ($percentage >= 70) return 'A';
    elseif ($percentage >= 60) return 'A-';
    elseif ($percentage >= 50) return 'B';
    elseif ($percentage >= 40) return 'C';
    elseif ($percentage >= 33) return 'D';
    else return 'F';
}

// Test cases
echo "Testing grade calculation:\n";
echo "85/100 (pass 33) = " . calculateSubjectGrade(85, 100, 33) . "\n";  // Should be A+
echo "75/100 (pass 33) = " . calculateSubjectGrade(75, 100, 33) . "\n";  // Should be A
echo "65/100 (pass 33) = " . calculateSubjectGrade(65, 100, 33) . "\n";  // Should be A-
echo "55/100 (pass 33) = " . calculateSubjectGrade(55, 100, 33) . "\n";  // Should be B
echo "45/100 (pass 33) = " . calculateSubjectGrade(45, 100, 33) . "\n";  // Should be C
echo "35/100 (pass 33) = " . calculateSubjectGrade(35, 100, 33) . "\n";  // Should be D
echo "30/100 (pass 33) = " . calculateSubjectGrade(30, 100, 33) . "\n";  // Should be F
echo "20/100 (pass 40) = " . calculateSubjectGrade(20, 100, 40) . "\n";  // Should be F (below pass marks)
?>