Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int number_of_digits(int n)
- {
- if(n == 0)
- return 0;
- else
- return 1 + number_of_digits(n/10);
- }
- int main()
- {
- int x, nr;
- scanf("%d ", &x);
- nr = number_of_digits(x);
- printf("%d\n", nr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement