Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to sort the given array using Selection Sort.
- #include <stdio.h>
- #include <conio.h>
- void main () {
- int i, j, temp,
- arr[10] = {
- 1, 23, 55, 2, 26, 66, 87, 21, 88, 54
- };
- clrscr ();
- for (i = 0; i < 10; i++) {
- for (j = i + 1; j < 10; j++) {
- if (arr[j] < arr[i]) {
- temp = arr[i];
- arr[i] = arr[j];
- arr[j] = temp;
- }
- }
- }
- for (i = 0; i < 10; i++) {
- printf ("%d\n", arr[i]);
- }
- getch ();
- }
Add Comment
Please, Sign In to add comment