fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n ; cin>>n ;
  7. int arr[n];
  8. for(int i =0;i<n;i++){
  9. cin>>arr[i];
  10. }
  11. for(int i =0;i<n-1;i++){
  12. for(int j =i+1;j<n;j++){
  13. cout<<"("<<arr[i]<<","<<arr[j]<<") ";
  14. }
  15. cout<<endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5320KB
stdin
6
2 3 4 5 6 7
stdout
(2,3) (2,4) (2,5) (2,6) (2,7) 
(3,4) (3,5) (3,6) (3,7) 
(4,5) (4,6) (4,7) 
(5,6) (5,7) 
(6,7)