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