Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- const int N = 7;
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int a[N],i;
- int c;
- for ( i = 0; i < N; i++)
- {
- cin >> a[i];
- }
- for ( i = 0; i < N; i++)
- {
- if (a[i] > 0 && a[i + 1] > 0)
- {
- cout << a[i] << " " << a[i + 1] << endl;
- }
- else if (a[i] < 0 && a[i + 1] < 0)
- {
- cout << a[i] << " " << a[i + 1] << endl;
- }
- }
- for ( i = 0; i < N ; i++)
- {
- if (a[i] > 0 && a[i + 1] < 0 || a[i] < 0 && a[i + 1] > 0)
- {
- c = a[i] * a[i + 1];
- if (c > 0 || c < 0)
- {
- cout << " ";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment