Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- int a[10], n = 10;
- for (int i = 0; i < n; i++)
- {
- cout << "Введите " << i << " эл. массива: ";
- cin >> a[i];
- }
- for (int i = 0; i < n; i++)
- {
- if (a[i] < 0) {
- a[i] = abs(a[i]);
- }
- else {
- a[i] *= a[i];
- }
- }
- cout << "Изменённый массив:" << endl;
- for (int i = 0; i < n; i++)
- {
- cout << a[i] << " ";
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement