fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int sum( int arr[], int size )
  5. {
  6. int res = 0;
  7. for ( int i = 0; i < size; i++ )
  8. res += arr[ i ];
  9. return res;
  10. }
  11.  
  12. int main() {
  13. int arr[3]={10,20,30};
  14. std::cout << sum( arr, 3 ) << "\n";
  15. // your code goes here
  16. return 0;
  17. }
Success #stdin #stdout 0s 4540KB
stdin
Standard input is empty
stdout
60