fork download
  1. #include <stdio.h>
  2. int sumodd(int n){
  3. if(n==1) return 1;
  4. else return n+sumodd(n-2);
  5. }
  6. int main(void) {
  7. int n;
  8. scanf("%d",&n);
  9. printf("%d\n",sumodd(n));
  10. return 0;
  11. }
  12.  
Success #stdin #stdout 0s 5272KB
stdin
9
stdout
25