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