Created
December 19, 2014 09:22
-
-
Save scratchyourbrain/8bcccf74822c2ddc7a36 to your computer and use it in GitHub Desktop.
C Program to Count Number of Digits of an Integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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