Advertisement
Alx09

Ex 1-Backtraking

Jun 1st, 2020
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int transf(int n)
  6. {
  7.     if (n == 0)
  8.         return 0;
  9.     if (n % 2)
  10.         return transf(n / 10);
  11.     else  
  12.         return n % 10 + transf(n / 10) * 10;
  13.      
  14. }
  15.  
  16. int main() {
  17.     printf("%d", transf(12345));
  18.     system("pause");
  19.     return 0;
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement