Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include<ctime>
  3. using namespace std;
  4. int main()
  5. {
  6.     int posit, m = 0, i = 0, n;
  7.     cout << ("Введите размер массива ");
  8.     cin>> n;
  9.     int* arr = new int[n];
  10.     for (int i = 0; i < n; i++)
  11.     {
  12.         arr[i] = rand() % 100;
  13.         cout<< arr[i]<< endl;
  14.     }
  15.     for (i = 2; i < n; i + 2)
  16.     {
  17.         if (m < arr[i])
  18.         {
  19.             m = arr[i];
  20.             posit = i;
  21.  
  22.         }
  23.         i = i + 2;
  24.     }
  25.     cout<< endl<<m<< endl;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement