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