Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scratchyourbrain/8bcccf74822c2ddc7a36 to your computer and use it in GitHub Desktop.
Save scratchyourbrain/8bcccf74822c2ddc7a36 to your computer and use it in GitHub Desktop.
C Program to Count Number of Digits of an Integer
#include <stdio.h>
int main()
{
int n,count=0;
printf("Enter an integer: ");
scanf("%d", &n);
while(n!=0)
{
n/=10;
++count;
}
printf("Number of digits: %d",count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment