adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in C to count the number of digits of a given number.

Write a program in C to count the number of digits of a given number.

#include<stdio.h>
#include<conio.h>
   void main()
    {
     int n,c=0;
     clrscr();
     printf("Enter a number:-");
     scanf("%d",&n);
     while(n!=0)
      {
        n=n/10;
        c++;
      }
   printf("Number of digits=%d",c);
   getch();
  }

Output:-


Post a Comment

0 Comments