Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- #include <math.h>
- #include <stdlib.h>
- int nCounter = 0;
- ///////////////////////////////////////////////
- void foo(long int n)
- {
- if(n == 0) return;
- nCounter ++;
- // printf("%d ", n % 10) ;
- foo(n / 10);
- }
- ///////////////////////////////////////////////
- void foo_2(long int n)
- {
- long int n2 = n,
- mult = 1;
- if(n == 0) return;
- nCounter --;
- for(int i = 0; i < nCounter; i++)
- {
- mult *= 10;
- }
- printf("%d ", n / mult) ;
- foo_2(n % mult);
- }
- ////////////////////////////////////////////////
- int main()
- {
- long int n ;
- long int k = 0, m;
- scanf("%ld", &n);
- foo(n);
- // printf("nCounter = %d\n", nCounter);
- foo_2(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment