C program example
Friday, May 11, 2012
Program to count number of digits in a number.
// program to count number of digits in a number.
#include<stdio.h>
#include<conio.h>
main()
{
int num,count=0;
printf("Enter a number: ");
scanf("%d",&num);
while(num)
{
num=num/10;
count++;
}
printf("Total digits is: %d",count);
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment