Skip to main content

PROGRAM TO CONVERT A BINARY NO. TO DECIMAL


#include<stdio.h>
#include<conio.h>
void main()
{
long int n=0,i=0,nos=0,p=1;
clrscr();
printf("enter a binary number \n");
scanf("%ld",&n);
while(n>0)
{
i=n%10;
nos=nos+i*p;
p=p*2;
n=n/10;
}
printf("%ld",nos);
getch();
}

SIMPLE PROGRAMS
FUNCTIONS


NUMBERS


STRINGS AND CHARACTERS

Comments

Popular posts from this blog

unix commands