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(i == 0) {
  22. printf("%d, ", rec(i));
  23. }
  24. else if(rec(i) % i == 0) {
  25. printf("%d, ", rec(i));
  26. }
  27. }
  28.  
  29. return 0;
  30. }
  31.  
  32.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
3, 0, 2, 3, 5, 7, 22, 39, 119, 209, 644, 3480, 6107, 33004, 101639, 178364, 549289,