I made this code for show how many digits have a number, example...
Enter a number: 546
The number have 3 digits.
with int he works fine, but i canīt make he work with double.
Code:
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
main()
{
double n, c;
char resposta = 's';
do
{
printf("\n\n");
printf(" ****************************************************\n");
printf(" * Infomar a quantidade de digitos de um numero: *\n");
printf(" ****************************************************\n");
printf("\n Digite um numero: ");
scanf("%lf", &n);
for(c = 0; n; n /= 10)
c++;
printf("\n ----> O numero possui %lf digitos.", c);
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf(" Deseja Continuar S/N?: ");
scanf( "\n %c", &resposta );
system("cls");
}while(toupper(resposta) == 'S');
}