fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int getSum(int x)
  6. {
  7. if(x==0)
  8. return 0;
  9. else
  10. return x + getSum(x-1);
  11. }
  12.  
  13.  
  14. int main() {
  15. // your code goes here
  16. cout<<getSum(10);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
55