Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int Contardig(int x)
- {
- int cont=0,aux;
- while (x!=0)
- {
- aux=x%10;
- x=x/10;
- cont++;
- }
- return cont;
- }
- int main()
- {
- int numero, digitos;
- printf("Ingrese numero y se cuentan los digitos de este:\n");
- scanf("%d", &numero);
- digitos = Contardig(numero);
- printf("El numero %d tiene %d digitos\n", numero, digitos);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment