30-Write a C program to find the length of a given number.

Program: 30

Write a C program to find the length of a given number.

#include
#include
void main()
{
    int num, count=0;
    printf("Enter any number: ");
    scanf("%d", &num);
    while(num)
    {
        num=num/10;
        count=count+1;
    }
    printf("Total digits are = %d", count);
    getch();
}
Output
Enter any number: 463463723

Total digits are = 9

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.