0% found this document useful (0 votes)
24 views3 pages

CP Assignment 6

Uploaded by

Aum Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

CP Assignment 6

Uploaded by

Aum Datta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Home assignment

1. To find the highest marks add this function as an


extension to the program and pass number of
students as a parameter in it
void sort_array(int n)
{
int i,j,a;
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (student_array[i] > student_array[j])
{
a = student_array[i];
student_array[i] = student_array[j];
student_array[j] = a;
}
}
printf("Highest marks are \n");
printf("%d\n", student_array[n-1]);

2. To find the specific marks add this function


searchmarks in the program and pass number of
students and the marks to be found in it
void search_marks(int n,int key)
{
int i;
for(i=0; i<n; i++)
{
if(student_array[i]==key)
{
printf("element found at index %d ",i);
return 0;
}
else{
printf("element not found ");
}
}

You might also like