fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[] = {9, 5, -7, -7, 5, -9, -4};
  6. int n = 7;
  7. for(int i = 0; i < n-1; i++){
  8. if(a[i] * a[i+1] < 0){
  9. cout<<a[i]<<" "<<a[i+1]<<endl;
  10. }
  11. }
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
5 -7
-7 5
5 -9