[C] bash:syntax error near unexpected token `('

The

array calculates the average, and this code can"t see the problem over and over again. Output bash:syntax error near unexpected token `("

)
-sharpinclude <stdio.h>
int main(void)
{
    int grades[10];
    unsigned int count = 10;
    long sum = 0L; 
    float average = 0.0f;

    //printf("\nEnter the number of people in your class:");
    //scanf("%u", &count);

    for(unsigned int i = 0 ; i < count ; PPi)
    {
        printf("The grade of class number %2u is", i+1);
        scanf("%d", &grades[i]);
        sum += grades[i];
    }
    
    average = (float)sum/count;

    printf("The average grade of the class is: %.2f", average);
    return 0;
}
C
Jan.21,2022

it's not the code. How do you execute it after compilation?

I guess you didn't compile, just press the script to execute
you need to save the code to c file, such as test.c
and then compile
such as

with gcc.
$ gcc test.c

generates an executable file a.out under the current folder

execute

$ ./a.out

will get the results you want.

Menu