diff --git a/Binary To Decimal.c b/Binary To Decimal.c index cc7caff8..93cb7d3f 100644 --- a/Binary To Decimal.c +++ b/Binary To Decimal.c @@ -1,17 +1,17 @@ #include #include -int main(){ - int number,decimal_number,temp=1; -printf("Enter any binary number= "); -scanf("%d",&number); - int remainder; - while(number>0){ - - remainder= number%10; - number=number/10; - decimal_number+=remainder*temp; - temp=temp*2;//used as power of 2 - - } - printf("%d",decimal_number); +int main() { + int number, decimal_number, temp=1; + printf("Enter any binary number= "); + scanf("%d", &number); + int remainder; + while(number>0) { + + remainder = number%10; + number = number/10; + decimal_number += remainder*temp; + temp = temp*2;//used as power of 2 + + } + printf("%d",decimal_number); }