1. ## Decimal > Binary

i am trying to create a program that will convert binary to decimal, i have got so far:

Code:
```#include <stdio.h>

main(void)
{
int num1, num2 = 0;

printf("Please enter a value between 0-255: ");
scanf("%d",&num2);

for

(num1=128;num1>0;num1=num1/2);
(num1=64;num1>0;num1=num1/2);
(num1=32;num1>0;num1=num1/2);
(num1=16;num1>0;num1=num1/2);
(num1=8;num1>0;num1=num1/2);
(num1=4;num1>0;num1=num1/2);
(num1=2;num1>0;num1=num1/2);
(num1=1;num1>0;num1=num1/2);
printf("%d",num1/1);
num1 = num1 &1;
}```
but i keep getting errors and i dont know why, any help would be appreciated.

2. Well, the errors tell you what the error is (they're helpful that way). But the upshot is you only get one set of parentheses for a for loop. And the other helpful bit about for loop is you don't have to work out what's going to happen in each loop -- the computer can do that. You just tell it num1 = num1/2 and it can work out that it will go from 128, to 64, to 32, etc.

3. Code:
```for

(num1=128;num1>0;num1=num1/2);
(num1=64;num1>0;num1=num1/2);
(num1=32;num1>0;num1=num1/2);
(num1=16;num1>0;num1=num1/2);
(num1=8;num1>0;num1=num1/2);
(num1=4;num1>0;num1=num1/2);
(num1=2;num1>0;num1=num1/2);
(num1=1;num1>0;num1=num1/2);
printf("&#37;d",num1/1);
num1 = num1 &1;
}```
That translates to:

Code:
`for(num1 = 128; num1 > 0; num1 /= 2)`
I think that's why.