12,625,402 members (35,996 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
 ppolymorphe 177 Peter Leow 153 Jochen Arndt 130 F-ES Sitecore 119 OriginalGriff 110
 OriginalGriff 1,112 ppolymorphe 656 John Simmons / outlaw programmer 509 Peter Leow 373 CPallini 338