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 a;
  8. scanf("%d",&a);
  9. printf("%d\n",sumodd(a));
  10. return 0;
  11. }
Success #stdin #stdout 0s 5272KB
stdin
9
stdout
25