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