Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int m;
- cout << "Enter the amount of elements: " << endl;
- cin >> m;
- int i;
- int j = 0;
- int* a;
- a = new int[m];
- cout << "Enter the elements: " << endl;
- for (i = 0; i < m; i++) {
- cin >> a[i]; //ввод чисел с клавиатуры
- }
- while (a[j] != 5) {
- j++;
- }
- while (a[m] != 5) {
- m--;
- }
- cout << "The first 5: The last 5:" << endl;
- cout << j + 1 << " " << m + 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement