Hi all this is my first time posting and I thought Id join this forum as I need some help now and again when I have problems with C. Also there seems to be alot of nice people on here .
I am trying to create a program with user inputting studentID,name and there unit mark. Outputting Student ID,name, average mark and Highest and lowest mark.
Any ideas on highest and lowest mark?
Code:
# include <stdio.h>
int main ()
/* declare variables */
{
int studentID, n, max_value;
float total_mark = 0, unit_mark = 0, average_mark, array;
/*Input ID*/
printf ("Enter your student ID: ");
scanf("%d",& studentID);
/*Input 12 marks + divide by 12 for average*/
for (n = 0; n < 12 ; n++)
{
printf("Enter your unit mark: ");
scanf("%f",&unit_mark);
total_mark = total_mark + unit_mark;
}
average_mark = total_mark /12;
/*Work out highest and lowest mark*/
max_value = array[0];
for (n = 0; n < 12 ; n++)
{
if (array[n] > max_value)
{
max_value = array[n];
}
}
printf("The student %d got a total mark of %6.2f and an average mark of %6.2f, ", studentID, total_mark, average_mark);
}
I have tried highest mark but it has a pointer error which I sort of know what it is.
Any help, thanks