0
#include <stdio.h>
#include <stdbool.h>
void printMenu(void);
void printLine(void);
int option;
float scores[3];
float getAvg(float*anyArray, int size);
char getGradeLetter(float x);

int main(void)
{
    char name[20] = { 0 };
    char result = '\0';
    bool name_entered = false;
    float sum=0, average=0;
    printLine();
    printMenu();
    
    if(1 == option)
    {
       name_entered = true;
        printf("Enter your name: ");
        scanf("%s", name);
    }
        else if(2 == option)
        {
           for (int i=0 ;i<3 ;++i)
            {
                printf("Enter number %d = ", i+1);
                scanf("\n%f", &scores[i]);
                
                sum = sum+scores[i];
            }
             average= getAvg(scores, 3);
        }
            else if(3 == option)
            {
                int i = 0;
                if((scores[i]= true))
                {
                   printf("Average = %0.1f\n", average);
                    
                }else
                {
                    printf("Please use the menu to enter exam scores first\n");
                }
                
            }
        else if(4 == option)
        {
            if(name_entered && scores)
            {
                result = getGradeLetter(average);
                printf("Hello %s, your exam scores are %0.1f, %0.1f and %0.1f. Your average score is %0.1f with Letter grade: %c\n", name, scores[0], scores[1], scores[2], average, result);
                
            }else
            {
                printf("Please use the menu to enter name and exam scores first\n");
        }
        }
    
    return 0;
}
void printMenu(void){

    
    do{
    printf("1. Enter User name\n");
    printf("2. Enter exam score\n");
    printf("3. Display average \n");
    printf("4. Display summary\n");
    printf("5. Quit\n");
    scanf("%i",&option);
    
    }while(option !=5);
    }
void printLine(void){
    for(int i =0; i<25; i++) {
        printf("*");
        
    }
}
float getAvg(float*anyArray, int size){
    float summ= 0;
       float average;
       
           for(int i=0; i<3; i++)
           {
               summ = summ + anyArray[i];
               average = summ/3;
           }
    return}
        


char getGradeLetter(float x){

    float average;
    char result;
    if (average >= 90 && average<=100)
           { result = 'A';}
        
        else if (average >= 80)
        { result = 'B';}
               
        else if (average >= 70)
        { result = 'C';}
        else if (average >= 60)
        { result = 'D';}
        else
        { result = 'F';}
    return
}
0

It would have been nice of you to tell us where it was happening. But I'm in a good mood, so I tried to compile it.

In both cases, it's the same. There needs to be a semicolon after each return statement and before the closing curly brace.

There are other issues, but that would be for a different question.

What problem set is this for????

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .