Toshkent Axborot Tehnologiya Unversiteti Kompyuter Injinering Fakulteti 220-22 gruh talabasi Mamajonov Abdullohning ma’lumotlar tuzilmasi va algaritmlash fanidan 1-amaliy ishi
#include
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for (int i=0; i< n; i++){
cin >> arr[i];
}
int t=0;
int manfiy_min = arr[0], musbat_min = arr[0];
for (int j=0; j< n; j++){
if (arr[j]manfiy_min = arr[j];
t = j;
}
}
int temp;
for (int i=0; i< n; i++) {
if (arr[i] >= 0)
musbat_min = arr[i];
}
int m=0;
for (int i=0; i< n; i++) {
if (arr[i] >= 0 && arr[i] < musbat_min){
musbat_min = arr[i];
m = i;
}
}
temp = arr[m];
arr[m] = arr[t];
arr[t] = temp;