Page

source code for convert binary to decimal in c language

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a=0,b=0,n,t;
clrscr();
printf("Enter the n value");
scanf("%d",&n);
while(n>0)
{
t=n%10;
a=a+(t*pow(2,b++));
printf("a=%d\n",a);
n=n/10;
}
printf("given number is  %d =",a);
getch();
}

No comments:

Post a Comment