fork download
  1. #include <stdio.h>
  2. //課題3
  3. int rec(int n){
  4. switch(n){
  5. case 0:
  6. return 3;
  7.  
  8. case 1:
  9. return 0;
  10.  
  11. case 2:
  12. return 2;
  13.  
  14. default:
  15. return rec(n-2)+rec(n-3);
  16. }
  17. }
  18.  
  19. int main(void) {
  20. int n = 50;
  21. for(int i = 1; i <= n; i++){
  22. if(rec(i)%i==0){
  23. printf("%d, ",i);
  24. }
  25.  
  26. }
  27.  
  28. return 0;
  29. }
  30.  
  31.  
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,