From df248452865bbc3bd1734aa5b3188d84ea5b99e9 Mon Sep 17 00:00:00 2001 From: KylerSmith Date: Wed, 12 Jul 2017 16:59:31 -0700 Subject: [PATCH] Syntax fix and file rename Binary_To_Decimal.c, remove executable --- Binary To Decimal.c | 17 ----------------- Binary_To_Decimal.c | 25 +++++++++++++++++++++++++ a.out | Bin 8816 -> 0 bytes 3 files changed, 25 insertions(+), 17 deletions(-) delete mode 100644 Binary To Decimal.c create mode 100644 Binary_To_Decimal.c delete mode 100755 a.out diff --git a/Binary To Decimal.c b/Binary To Decimal.c deleted file mode 100644 index 93cb7d3f..00000000 --- a/Binary To Decimal.c +++ /dev/null @@ -1,17 +0,0 @@ -#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); -} diff --git a/Binary_To_Decimal.c b/Binary_To_Decimal.c new file mode 100644 index 00000000..8404ecc9 --- /dev/null +++ b/Binary_To_Decimal.c @@ -0,0 +1,25 @@ +/** + * Modified 07/12/2017, Kyler Smith + * + */ + +#include + +int main() { + + int remainder, number = 0, decimal_number = 0, temp = 1; + printf("Enter any binary number= "); + scanf("%d", &number); + + // Iterate over the number until the end. + while(number > 0) { + + remainder = number % 10; + number = number / 10; + decimal_number += remainder * temp; + temp = temp*2; //used as power of 2 + + } + + printf("%d\n", decimal_number); +} diff --git a/a.out b/a.out deleted file mode 100755 index 2e5e0141d89919a60553275cd7927cf0b1e8d0f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8816 zcmeHMZ){uD6~DHVHvNO+mH_?3RtwrKREtSU8q$^xJIQNbP||j7To^38IJT1*61&*X zEJfwdWMFtEU8n6s_F)>*n8rR#>h@uaCbp)uA}vBwKm~PLKLixOp}>L|UG|4&zjNO` zj{V|H)wD_buxq_{?)lww&OP_ubML$N`f;sex6|PeoSfn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