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