Wednesday, July 22, 2020

Octal to Decimal Conversion

Octal to Decimal Conversion
=====================
void main()
{
int dec,i,j;
long int octal;
clrscr();
printf("Enter binary value\n");
scanf("%ld",&octal);
i=0;
dec=0;
top:
j=octal%10;
octal/=10;
dec=dec+(j*pow(8,i));
if(octal>0)
{
i++;
goto top;
}
printf("decimal vlaue is: %d",dec);
getch();
}

No comments:

Post a Comment

Octal to Decimal Conversion

Octal to Decimal Conversion ===================== void main() { int dec,i,j; long int octal; clrscr(); printf("Enter binary val...