You are on page 1of 1

#include <iostream>

using namespace std;

int main()
{
int V[10];
int n, c, d, t;
cout << "Introduceti numarul de elemente: ";
cin >> n;

cout << "Introduceti " << n << " variabile: ";


for (c = 0; c < n; c++) {
cin >> V[c];
}

for (c = 0; c < n - 1; c++) {


for (d = 0; d < n - c - 1; d++) {
if (V[d] > V[d + 1]) {
t = V[d];
V[d] = V[d + 1];
V[d + 1] = t;
}
}
}
cout << "Lista in ordine crescatoare este: ";
for (c = 0; c < n; c++) {
cout << V[c] << " ";
}
return 0;
}

You might also like