#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "russian");
int mas[100];
int k;
cin >> k;
for (int i = 0; i < 100; i++)
mas[i] = rand() % 10;
cout << mas[i]<< " ";
}
cout << endl<<endl;
for (int i = 0; i < k; i++)
mas[i] = -(mas[i]);
cout<< mas[i]<<" ";
Объяснение:
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "russian");
int mas[100];
int k;
cin >> k;
for (int i = 0; i < 100; i++)
{
mas[i] = rand() % 10;
cout << mas[i]<< " ";
}
cout << endl<<endl;
for (int i = 0; i < k; i++)
{
mas[i] = -(mas[i]);
}
for (int i = 0; i < 100; i++)
{
cout<< mas[i]<<" ";
}
}
Объяснение: