I am programming a program that will convert a string (char) into it's ASCII value, I am having one issue though. The output is correct but I get a value of " 10 " at the end of the output every single time I run the program ? Any thoughts on why this might be ? I am newer to C , for what it is worth. Thank you all in advance for any suggestions!!
Code:#include <stdio.h> #include <stdlib.h> #include <ctype.h> const int size = 50; int main() { char word[size]; int x = 0; printf ("Please enter a line of text ( Max 25 characters) or 'Q' or 'q' to quit:\n\n"); fgets(word, size, stdin); while (word[x] != '\0') { printf ("The ASCII for this word is: %d%\n\n",word[x]); x++; } for( x = 0; x < 1; x++) printf("%c", toupper(word[0])); printf("%c", tolower(word[1])); printf("%c", toupper(word[2])); printf("%c", tolower(word[3])); printf("%c", toupper(word[4])); printf("%c", tolower(word[5])); printf("%c", toupper(word[6])); printf("%c", tolower(word[7])); printf("%c", toupper(word[8])); printf("%c", tolower(word[9])); printf("%c", toupper(word[10])); printf("%c", tolower(word[11])); printf("%c", toupper(word[12])); printf("%c", tolower(word[13])); printf("%c", toupper(word[14])); printf("%c", tolower(word[15])); printf("%c", toupper(word[16])); printf("%c", tolower(word[17])); printf("%c", toupper(word[18])); printf("%c", tolower(word[19])); printf("%c", toupper(word[20])); printf("%c", tolower(word[21])); printf("%c", toupper(word[22])); printf("%c", tolower(word[23])); printf("%c", toupper(word[24])); printf("%c", tolower(word[25])); getchar(); return 0; }


