Untitled
unknown
plain_text
2 years ago
324 B
1
Indexable
#include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; int a[100]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = n-1; i >= 0; i--) { if (a[i] % 2 == 1) a[i] = 0; if (a[i] < 0) a[i] = -a[i]; } for (int i = 0; i < n; i++){ cout << a[i] << ' '; } }
Editor is loading...