Powered By Blogger

Friday, December 24, 2010

C Program to find the number of digits in a long number

/* C Program to find the number of digits in a given long integer number */

#include <stdio.h>

int main()
{
    long num;
    int count=0;

    printf("Enter the number\n");
    scanf("%ld",&num);

    while(num>0)
    {
        num=num/10;
        count++;
    }

    printf("The number of digits in the give number is %d",count);

    return 0;
}

No comments:

Post a Comment