Program to find out the highest and lowest marks obtained in a class of 10 students.



/* Write a program to find out the highest and lowest
marks obtained in a class of 10 students. */

#include

int main(void)
{
int marks[10], i, high, low;

for(i = 0 ; i < 10 ; i++)
{
printf("\nMarks %d :", i + 1);
scanf("%d", &marks[i]);
}

high = low = marks[0];

for(i = 0 ; i < 10 ; i++)
{
if(marks[i] > high) high = marks[i];
if(marks[i] < low) low = marks[i];
}

printf("\nHighest marks is %d\nLowest marks is %d", high, low);

return 0;
}

No comments:

Post a Comment