Advertisement
Polnochniy

Untitled

Nov 13th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6. setlocale(LC_ALL, "Rus");
  7. int N;
  8. cout << "Введите число элементов " << endl;
  9. cin >> N;
  10. int *a= new int [N];
  11. cout << "Введите элементы массива .Выведите четные индексы массива " << endl;
  12. for (int i = 0; i < N; i++)
  13. {
  14. cin >> a[i];
  15. }
  16. for (int i = 0; i < N; i++)
  17. {
  18. if (i % 2 == 0)
  19. {
  20. cout << "Номер четных индексов " << i << " ";
  21. cout << "А сами элементы " << a[i] << " " << endl;
  22. }
  23. }
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement