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