Translate

Labels

Showing posts with label BINARY TO DECIMAL. Show all posts
Showing posts with label BINARY TO DECIMAL. Show all posts

Friday, 28 December 2012

CHANGING BINARY NUMBER TO DECIMAL NUMBER USING C PROGRAM

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,d,i;
d=0;
i=0;
clrscr();
printf("Enter any number:");
scanf("%d",&n);
while(n!=0)
{
d=d+(n%10)*pow(2,i);
n=n/10;
i=i+1;
}
printf("\n\n The decimal number is %d",d);
getch();
}