Cod sursa(job #2976194)
| Utilizator | Data | 8 februarie 2023 16:46:11 | |
|---|---|---|---|
| Problema | Sortare prin comparare | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <iostream>
using namespace std;
int v[100];
int main(){
int n, i, j;
int aux;
cin >> n;
for(i = 0; i < n; i ++){
cin >> v[i];
}
for(j = 0; j < n - 1; j ++){
for(i = 0; i < n - 1; i ++){
if(v[i + 1] < v[i]){
aux = v[i + 1];
v[i + 1] = v[i];
v[i] = aux;
}
}
}
for(i = 0; i < n; i++){
cout << v[i] << " ";
}
cout << endl;
return 0;
}
