0

This is my code to convert from binnary to octal ......what is the logic error in my code?

```
void main()
{
double base=2;
char bin[10000];
int res,sum=0;
cout<<"Enter the binnary number:";
cin>>bin;
int len;
len=strlen(bin);
int coun=0;
for(int i=0;i<len;i=i+3)
{
for(int j=0;j<3;j++)
{
res=bin[i]-'0';
sum=sum+res*(int) pow(base,j);
}
cout<<sum;
}
}
```