dllbridge

Untitled

Sep 27th, 2025
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3. #include  <locale.h>      
  4. #include    <math.h>
  5. #include  <stdlib.h>
  6.  
  7.  
  8.  
  9. int nCounter = 0;
  10.  
  11. ///////////////////////////////////////////////
  12. void foo(long int n)
  13. {
  14.      if(n == 0) return;
  15.  
  16.      nCounter ++;
  17.  
  18.    //  printf("%d ", n % 10) ;
  19.  
  20.      foo(n / 10);  
  21. }
  22.  
  23.  
  24. ///////////////////////////////////////////////
  25. void foo_2(long int n)
  26. {
  27.      long int n2   = n,
  28.           mult = 1;
  29.    
  30.      if(n == 0) return;
  31.  
  32.      nCounter --;
  33.      for(int i = 0; i < nCounter; i++)
  34.      {
  35.            
  36.         mult *= 10;    
  37.      }
  38.      
  39.  
  40.      printf("%d ", n / mult) ;
  41.  
  42.      foo_2(n % mult);  
  43. }
  44.  
  45.  
  46.  
  47. ////////////////////////////////////////////////
  48. int main()
  49. {
  50.     long int n       ;
  51.     long int k = 0, m;
  52.    
  53.     scanf("%ld", &n);
  54.    
  55.     foo(n);
  56.    
  57.    // printf("nCounter = %d\n", nCounter);
  58.  
  59.     foo_2(n);
  60.  
  61. return 0;
  62. }
  63.  
  64.  
  65.  
  66.  
Advertisement
Add Comment
Please, Sign In to add comment