josiftepe

Untitled

Dec 28th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. int rekurzija(int broj)
  4. {
  5.     if (broj == 0)
  6.         return 0;
  7.     int digit = broj % 10;
  8.     if (digit ==7)
  9.         digit = 4;
  10.     return rekurzija(broj/10) * 10 + digit;
  11. }
  12. int rekurzija2(int broj)
  13. {
  14.     if (broj == 7)
  15.        return 4;
  16.     else return rekurzija(broj);
  17. }
  18.  
  19.  int main()
  20.  {
  21.      int n;
  22.      printf("Vnesi broj\n");
  23.      scanf("%d",&n);
  24.      printf("%d",rekurzija(n));
  25.      return 0;
  26.  }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment