Răspuns:
#include <iostream>
using namespace std;
int main(){
int a[12];
int min_poz;
int max_neg;
int f1 = 0, f2 = 0;
int i;
for (i = 0;i < 12; i++) {
cout << "Temeperatura in luna " << i + 1 << ':';
cin >> a[i];
}
for (i = 0;i < 12; i++)
if (a[i] < 0){
max_neg = a[i];
break;
}
for (i = 0;i < 12; i++)
if (a[i] > 0){
min_poz = a[i];
break;
}
for (i = 0;i < 12; i++){
if (a[i] > 0){
if (a[i] < min_poz)
min_poz = a[i];
}
if (a[i] < 0){
if (a[i] > max_neg)
max_neg = a[i];
}
}
cout << "Temeperatura minima pozitiva:" << min_poz << "\n";
cout << "Temepratura maxima negativa:" << max_neg << endl;
return 0;
}
Explicație: