Polnochniy

Untitled

Nov 12th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. const int N = 7;
  4. using namespace std;
  5. int main()
  6. {
  7. setlocale(LC_ALL, "Rus");
  8. int a[N],i;
  9. int c;
  10. for ( i = 0; i < N; i++)
  11. {
  12. cin >> a[i];
  13. }
  14. for ( i = 0; i < N; i++)
  15. {
  16. if (a[i] > 0 && a[i + 1] > 0)
  17. {
  18. cout << a[i] << " " << a[i + 1] << endl;
  19. }
  20. else if (a[i] < 0 && a[i + 1] < 0)
  21. {
  22. cout << a[i] << " " << a[i + 1] << endl;
  23. }
  24. }
  25. for ( i = 0; i < N ; i++)
  26. {
  27. if (a[i] > 0 && a[i + 1] < 0 || a[i] < 0 && a[i + 1] > 0)
  28. {
  29. c = a[i] * a[i + 1];
  30. if (c > 0 || c < 0)
  31. {
  32. cout << " ";
  33. }
  34. }
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment