C program to convert Binary number to Decimal number

Simple C program to convert Binary number to Decimal number

Code:

#include<stdio.h>
#include<conio.h>
main()
{
int rem,base=1;
long int dvalue=0,num;
clrscr();
printf("Enter the number");
scanf("%d",&num);
while(num>0)
{
rem=num%10;
dvalue=dvalue+rem*base;
num=num/10;
base=base*2;
}
printf("the decimal value is: %d",dvalue);
getch();
}

Comments

Popular posts from this blog

C program to evaluate Prefix Expression using Stack data structure

Servlet Program to Print Today’s Date and Time using refresh header

Java Program to Implement sorting algorithm using TCP on Server application