#include<stdio.h>
int main() {
int arr[5] = {44, 33, 55, 22, 11};
int temp;
for(int i = 0; i<=4; i++) {
for(int j = i + 1; j<=5 ;j++) {
if(arr[i] > arr[j]){
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
for(int i = 0; i<=4; i++) {
printf("%4d", arr[i]);
}
return 0;
}
Saturday, November 27, 2021
implementation of selction sort algorithm on an unsorted array ( sorting array elements ).......
Subscribe to:
Post Comments (Atom)
Priority queue deleting elements after ascending inputs Gaand Fadd
using namespace std; #include<iostream> #define N 5 class pq { public: int* arr; int front; int rear; pq() { ...
-
using namespace std; #include<stdio.h> #define N 5 class q{ public: int* arr; int front; int rear; q() { ...
-
#include<stdio.h> int fnCmp(char* str1, char* str2) { while( (*str1 != '\0' && *str2 != '\0') && ...
-
#include<stdio.h> void fncpy(char* str2, char* str1) { int i = 0; while(*str1 != '\0') { str2[i] = *str1; ...
No comments:
Post a Comment