Friday 17 January 2014

Filled Under:

Write a program to convert binary to deimal?


#include<stdio.h>
#include<conio.h>
void main()
{
    int bin,dec=0,temp,rem,j=1;

    printf("Enter Any Binary Number:");
    scanf("%d",&bin);

    temp=bin;

    while(temp!=0)
    {
        rem=temp%10;
        dec=dec+rem*j;
        j=j*2;
        temp=temp/10;
    }

    printf("The Equivalent Decimal Number Of %d is %d",bin,dec);
}

0 comments:

Post a Comment