/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <math.h>
int contarDigitos(int x)
{
if(x == 0)
++x;
else if(x < 0)
x = -x;
return (int)log10(x) + 1;
}
int main(void)
{
printf("%d\n", contarDigitos(0));
printf("%d\n", contarDigitos(-1));
printf("%d\n", contarDigitos(-1000));
printf("%d\n", contarDigitos(20));
printf("%d\n", contarDigitos(50000));
return 0;
}