Polnochniy

Untitled

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