fork download
  1. #include <stdio.h>
  2. //第5回課題4
  3. int rec(int n)
  4. {
  5. //rec内を完成させてください
  6.  
  7. if(n == 0)
  8. { return 3;}
  9. else if(n == 1)
  10. { return 0;}
  11. else if(n == 2)
  12. { return 2;}
  13. else
  14. { return rec(n-2) + rec(n-3);}
  15.  
  16.  
  17.  
  18. }
  19.  
  20. int main(void) {
  21. int n = 50;
  22. for(int i = 1; i <= n; i++){
  23.  
  24. if( rec(i)%i == 0 )
  25. { printf("%d ", i); }
  26.  
  27. }
  28.  
  29. return 0;
  30. }
  31.  
  32.  
Success #stdin #stdout 0.02s 5288KB
stdin
Standard input is empty
stdout
1  2  3  5  7  11  13  17  19  23  29  31  37  41  43  47