Write a program in c which counts for the number of digits in an integer number being entered by user using: do While loop
/*
 * If need use do ... while only
*/
#include <stdio.h>
void main()
{
    int num, digit = 0;
    printf("Input number: ");
    scanf("%d", &num);
    do
        digit += !!num;
    while (num /= 10);
    printf("Digits: %d\n", digit);
}
Comments