fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int arr[]= {0, -1, 2, -3, 1};
  6. int n=sizeof(arr)/sizeof(arr[0]);
  7. int x=-2;
  8. bool flag=false;
  9. for(int i=0;i<n;i++){
  10. for(int j=i+1;j<n;j++){
  11. if(i==j)
  12. continue;
  13. else if(arr[i]+arr[j]==x){
  14. cout<<"yes";
  15. flag=true;
  16. break;
  17. }
  18. }
  19. }
  20. if(flag==false)
  21. cout<<"no";
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
yes