Advertisement
Josif_tepe

Untitled

Dec 15th, 2022
844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int broj_na_deliteli_na_x(int x, int i) {
  5.     if(i > x) {
  6.         return 0;
  7.     }
  8.     int delitel = 0;
  9.     if(x % i == 0) {
  10.         delitel = 1;
  11.     }
  12.     return broj_na_deliteli_na_x(x, i + 1) + delitel;
  13. }
  14. int main() {
  15.     printf("%d\n", broj_na_deliteli_na_x(10, 1));
  16.    
  17. }
  18. // broj_na_deliteli_na_x(10, 1) --> broj_na_deliteli_na_x(10, 2) + 1
  19. // broj_na_deliteli_na_x(10, 2) --> broj_na_deliteli_na_x(10, 3) + 1
  20. // broj_na_deliteli_na_x(10, 3) --> broj_na_deliteli_na_x(10, 4) + 0
  21. // broj_na_deliteli_na_x(10, 4) --> broj_na_deliteli_na_x(10, 5) + 0
  22. // broj_na_deliteli_na_x(10, 5)....
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement