Start New Discussion within our Software Development Community

{-='Calculate 3 Scores using Dev-C LaNguaGe'=-}

#include <stdio.h>

int main(void)  
{
//  Local Declarations
    float grade1, grade2, grade3;
    float totalGrade, Ave2;
    
//  Statements
    printf("Enter your three scores: ");
    scanf("%f %f %f", &grade1, &grade2, &grade3);
    printf("Your three scores: %.2f %.2f %.2f\n", grade1, grade2, grade3);
    
    totalGrade = (grade1 + grade2 + grade3) / 3;
    Ave2 = (grade2 + grade3) / 2;
    
    printf("Your average score is: %.2f%%\n", totalGrade);
    
    if (totalGrade >= 90)
       printf("Your grade is A");
    else if (totalGrade >= 70 && totalGrade < 90)
       printf("Your grade is B");
    else if (grade3 >= 90)
       printf("Your grade is A");
    else if (totalGrade >= 50 && totalGrade < 70)
    {   
         if (Ave2 >= 70)
            printf("Your grade is C");

         else
            printf("Your grade is D");
    }// else if
    else if (totalGrade <= 50)
       printf("Your grade is F\n");
       
    system("pause");
    return 0;
}// main