#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
void main()
{
int a[20],b[20];
int i,j,k,c,fra,flag,rem;
float rem1;
char s[20];
c=fra=flag=rem=0;
rem1=0.0;
clrscr();
printf("ENTER THE OCTAL NUMBER : ");
scanf("%s",s);
for(i=0,j=0,k=0;i<strlen(s);i++)
{
if(s[i]=='.')
{
flag=1;
}
elseif(flag==0)
a[j++]=s[i]-48;
elseif(flag==1)
b[k++]=s[i]-48;
}
c=j;
fra=k;
for(j=0,i=c-1;j<c;j++,i--)
{
rem = rem +(a[j] * pow(8,i));
}
for(k=0,i=1;k<fra;k++,i++)
{
rem1 = rem1 +(b[k] / pow(8,i));
}
rem1=rem+rem1;
printf("\nTHE DECIMAL VALUE OF GIVEN OCTAL NO IS : %f",rem1);
getch();
}
/* OUTPUT
--------------------------------------------------------
ENTER THE OCTAL NUMBER : 103.88
THE DECIMAL VALUE OF GIVEN OCTAL NO IS : 68.125000
*/