13,252,815 members (50,203 online)
Rate this:
See more:
```void main()
{
long n,dec,mult,r,base;
clrscr();
printf("\n Enter a base : ");
scanf("%ld",&base);
printf("\n Enter a number :");
scanf("%ld",&n);
dec = 0;
mult=1;
printf("\n Decimal equivalent of base %ld number %ld is ",base,n);
while ( n != 0 )
{
r = n % 10;
n /= 10;
r = r * mult;
dec = dec + r;
mult *= base;
}
printf("%ld",dec);}```

this program converts the integer part of any number system of base 2, 8 &16 to decimal. please tell me wht command shld b given 2 calculate the fractional part also. i need it urgently plz help.
Posted 20-Sep-12 8:03am
BeenaM108
Updated 20-Sep-12 8:04am
v2
ridoy 20-Sep-12 13:07pm

clear the question more..

Rate this:

## Solution 1

Each digit to the right of the decimal point is the reciprocal of the power of the base for that base. So for octal numbers the value 0.44 equates to
```0
4 / 8  // .4
4 /64  // . 04```

Top Experts
Last 24hrsThis month
 OriginalGriff 240 Richard Deeming 120 ppolymorphe 110 Karthik Bangalore 95 Peter Leow 45
 OriginalGriff 3,834 Karthik Bangalore 2,171 ppolymorphe 1,539 Dave Kreskowiak 1,301 CPallini 1,240