1 задание
#include
#include
using namespace std;
int main(){
srand(time(NULL));
int N, min = 10, range = 30;
int *arr;
cout << "enter size of arr(enter N) : ";<br> cin >> N;
arr = new int [N];
for(int i = 1; i <= N;i++)<br> arr[i] = rand()%(range + 1) + min;
cout << "arr : " << endl;<br> for(int i = 1; i <= N;i++)<br> cout << arr[i] << " " ;<br> cout << endl;<br> for(int i = 1; i <= N;i++){<br> if(arr[i] > 25)
arr[i] = i*i;
else
arr[i] = arr[i] + 5;
}
cout << "NEWarr : " << endl;<br> for(int i = 1; i <= N;i++)<br> cout << arr[i] << " " ;<br>}
2 задание
#include
using namespace std;
int main(){
int N;
int *arr;
cout << "enter size of arr(enter N) : ";<br> cin >> N;
arr = new int [N];
for(int i = 1; i <= N;i++)<br> cin >> arr[i];
int temp = arr[1];
int templ = arr[N];
arr[1] = arr[2];
arr[2] = temp;
arr[N] = arr[N-1];
arr[N-1] = templ;
cout << "new arr : ";<br> for(int i = 1; i <= N;i++)<br> cout << arr[i] << " " ;<br>}