• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Start selling Create your account
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

Sorting algorithms in C

Document preview thumbnail
Preview 2 out of 5 pages

Sorting algorithms in C

Content preview

SOLENT UNIVERSITY

t = n[j];
n[j] = n[j + 1];
n[j + 1] = t;}
}
}
if (i % 2 == 0) {
m = (n[i / 2] + n[(i - 1) / 2]) / 2.0;
} else
m = n[i / 2];
printf("The array elements rearrange by numerical order are:\n");
for (i = 0; n[i] != term; i++)
printf("%d\t", n[i]);
printf("\nThe median value in the array is: \n%.1f", m); } else if (choice == 'x' || choice == 'X') {
return;
} else
printf("\nWrong input, sorry.");
}
}
printf("Please enter 1 to 30 elements only.");
}

In figures 71,72,73,74,75 and 76 the program is running properly with getchar();. All the menu is inside a
while loop, that it run as true condition ( no equal to EOF, end-of-file) till the user enter the character x or X
(return;).




Fig71-Task5-GradeA




56

, SOLENT UNIVERSITY




Fig72-Task5-GradeA




Fig73-Task5-GradeA




Fig74-Task5-GradeA


57

Document information

Study
Unknown
Uploaded on
March 22, 2023
Number of pages
5
Written in
2022/2023
Type
Exam (elaborations)
Contains
Unknown
£5.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
0
Items
8
Last sold
3 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions