From 9d32762e395de7a867130ef4239dae830309d84d Mon Sep 17 00:00:00 2001 From: Hyder Date: Fri, 1 Aug 2025 15:11:01 +0300 Subject: Finally i knew the problem why the about page was not showing anything it turns out that i have to build cgit with markdown rendering but mine is just basic text file --- HTOI.c | 38 -------------------------------------- HTOI/HTOI.c | 38 ++++++++++++++++++++++++++++++++++++++ README | 12 +++++++++--- 3 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 HTOI.c create mode 100644 HTOI/HTOI.c diff --git a/HTOI.c b/HTOI.c deleted file mode 100644 index a565224..0000000 --- a/HTOI.c +++ /dev/null @@ -1,38 +0,0 @@ -# include - -# define HexBase 16 - -int HexadecimalToInteger(char string[]) { - - // The standalone Number *10* here in the FOR LOOP is a complementary value to make the hexadecimal function output correct values. - - int DecimalNumberTotal = 0; - - for (int i = 0;string[i] != '\0'; ++i) { - if (string[i] >= '0' && string[i] <= '9') { - DecimalNumberTotal = HexBase * DecimalNumberTotal + string[i] - '0'; - } - else if (string[i] >= 'a' && string[i] <= 'f') { - DecimalNumberTotal = HexBase * DecimalNumberTotal + (string[i] - 'a' + 10); - } - else if (string[i] >= 'A' && string[i] <= 'F') { - DecimalNumberTotal = HexBase * DecimalNumberTotal + (string[i] - 'A' + 10); - } - } - return(DecimalNumberTotal); -} - -// THE MAIN BLOCK - -int main () { - char TheHexString[1000]; - printf("Give me a Hexadecimal to convert (Without the prefix 0x)\n\n"); - - while (scanf("%s", &TheHexString) != EOF) { - - int res = HexadecimalToInteger(TheHexString); - printf("The result is : %d\n\n", res); - - } - return 0; -} \ No newline at end of file diff --git a/HTOI/HTOI.c b/HTOI/HTOI.c new file mode 100644 index 0000000..a565224 --- /dev/null +++ b/HTOI/HTOI.c @@ -0,0 +1,38 @@ +# include + +# define HexBase 16 + +int HexadecimalToInteger(char string[]) { + + // The standalone Number *10* here in the FOR LOOP is a complementary value to make the hexadecimal function output correct values. + + int DecimalNumberTotal = 0; + + for (int i = 0;string[i] != '\0'; ++i) { + if (string[i] >= '0' && string[i] <= '9') { + DecimalNumberTotal = HexBase * DecimalNumberTotal + string[i] - '0'; + } + else if (string[i] >= 'a' && string[i] <= 'f') { + DecimalNumberTotal = HexBase * DecimalNumberTotal + (string[i] - 'a' + 10); + } + else if (string[i] >= 'A' && string[i] <= 'F') { + DecimalNumberTotal = HexBase * DecimalNumberTotal + (string[i] - 'A' + 10); + } + } + return(DecimalNumberTotal); +} + +// THE MAIN BLOCK + +int main () { + char TheHexString[1000]; + printf("Give me a Hexadecimal to convert (Without the prefix 0x)\n\n"); + + while (scanf("%s", &TheHexString) != EOF) { + + int res = HexadecimalToInteger(TheHexString); + printf("The result is : %d\n\n", res); + + } + return 0; +} \ No newline at end of file diff --git a/README b/README index c6c3b41..0448e2f 100644 --- a/README +++ b/README @@ -1,5 +1,11 @@ -# Random Stuff as a learning journal +RANDOM STUFF AS A LEARNING JOURNAL +================================== -## Contents +CONTENTS +-------- -- The greatest common divisor exercise solution. \ No newline at end of file +* CHECK FILES IN THE TREE TAB + + +- The greatest common divisor exercise solution in ROOT/GCD/GCD.c +- Hexadecimal to integer converter solution in ROOT/HTOI/HTOI.c \ No newline at end of file -- cgit v1.2.3