In need some help with this little programming .. I just got 3 errors ..

:'(

#include <stdio.h>
int main (void)
{
    char A , B , C , D , E , F;
    int id1[ ];
    float grade[ ];
    float marks[ ];
    float average;
    float num1, kk=0;
/********* Jami, Abdulrahman *********/
    printf("Enter The Student ID: ");
    scanf("%d", &num1);
    for (kk=0; kk<num1; kk++);
    {
        scanf("%d", &id1[kk]);
        scanf("%d", &grade[kk]);
    }
    for (kk=0; kk<num1; kk++);
    {
        if (grade [kk]>85 &grade [kk]<=100);
        A=A+1;
        
        if (grade [kk]>70 &grade [kk]<85);
        B=B+1;
        
        if (grade [kk]>55 &grade [kk]<70);
        C=C+1;
        
        if (grade [kk]>40 &grade [kk]<55);
        D=D+1;
        
        if (grade [kk]>25 &grade [kk]<40);
        E=E+1;
        
        if (grade [kk]>=0 &grade [kk]<25);
        F=F+1;
    }
/********* Jami, Abdulrahman *********/
float aveerage;
float avrg, sum, lk;
    sum = sum + marks[lk];
    average = sum / num1;
    
    for (lk=0; lk<num1; lk++);
        
        return average;
}

I got 3 ERRORS in line 5, 6 and 7
this is the error msg:
( Definition of variable with array type needs an explicit size or an initializer )

You have more problems than just lines 5,6, 7.

To fix lines 5, 6, 7 make them pointers and then use calloc() to allocate blocks of memory for them after figuring out how many students you are gonna have input for.

You were putting ';' at the end of the loops. This is legal but nothing happens. Remove them and it will actually loop rather than run once.

#include <stdio.h>
#include <stdlib.h>
int main (void)
{
    int A = 0 , B = 0, C = 0, D = 0, E = 0, F = 0;
    int *id1;
    float *grade;
    float average;
    int kk;
    int num1;
/********* Jami, Abdulrahman *********/
    printf("Enter The Number of students: ");
    scanf("%d", &num1);

	//sets the size of the arrays
    id1 = (int*)calloc(num1, sizeof(int));
    grade = (float*)calloc(num1, sizeof(float));


    for (kk = 0; kk < num1; kk++)
    {
    	printf("Enter The Student ID: ");
        scanf("%d", &id1[kk]);
        printf("Enter The Student's grade: ");
        scanf("%f", &grade[kk]);
        printf("\n");
    }

    for (kk=0; kk<num1; kk++)
    {
        if (grade [kk]>85 && grade [kk]<=100)
			A=A+1;

        if (grade [kk]>70 && grade [kk]<85)
			B=B+1;

        if (grade [kk]>55 && grade [kk]<70)
			C=C+1;

        if (grade [kk]>40 && grade [kk]<55)
			D=D+1;

        if (grade [kk]>25 && grade [kk]<40)
			E=E+1;

        if (grade [kk]>=0 && grade [kk]<25)
			F=F+1;
    }
/********* Jami, Abdulrahman *********/
	float sum = 0;
	for( kk = 0; kk < num1; kk++ )
	    sum = sum + grade[kk];
    average = sum / num1-1;
    printf("The Average is %f%%\n", average);
    printf("There are:\n");
    printf("%d - As\n%d - Bs\n%d - Cs\n%d - Ds\n%d - Es\n%d - Fs\n", A, B, C, D, E, F);


    return 0;
}

Aha, so this is how it works ..
thanx sfuo :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.