1)
#include
using namespace std;
signed main() {
int n;
cin >> n;
int b[n];
for(int i = 0; i < n; i++)
cin >> b[i];
int mn = INT_MAX, mn_index = -1;
for(int i = 0; i < n; i++)
if(b[i] < mn && b[i] > 0){
mn = b[i];
mn_index = i;
}
cout << mn << "\n" << mn_index + 1;</p>
}
2)
#include
using namespace std;
signed main() {
int k;
cin >> k;
int N[k];
for(auto &i: N)
cin >> i;
int sum = 0, cnt = 0;
for(auto i: N)
if(i % 2 == 1){
sum += i;
cnt ++;
}
cout << sum << "\n" << cnt;</strong>
}
3)
#include
using namespace std;
void swap(int *a, int *b){
int temp = *a;
*a = *b;
*b = temp;
}
signed main() {
int j;
cin >> j;
int a[j];
for(auto &i: a)
cin >> i;
int mx_index = -1, mn_index = -1,mx = -INT_MAX, mn = INT_MAX;
for(int i = 0; i < j; i++){
if(a[i] > mx){
mx = a[i];
mx_index = i;
}
if(a[i] < mn){
mn = a[i];
mn_index = i;
}
}
swap(a+mn_index,a+mx_index);
for(auto i: a)
cout << i << " ";</p>
}