Programmers blog
Programs
Friday, 22 March 2013
C PROGRAM TO COUNT THE NUMBER OF DIGITS IN A GIVEN NUMBER
C program to Count the binary digits in a given decimal number
Count the binary digits in a given decimal number
#include<stdio.h>
void main()
{
int n,count=1;
double t;
printf("Enter A Number\n");
scanf("%d",&n);
while(n>1)
{
n/=2;
count++;
}
printf("Number Of Digits=%d",count);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment