I'm struggling with getting the for loop to read each individual character entered by the user. For example when I enter 95014 it keeps reading 9 and doesn't read the next characters. So it ends up outputting the same part for 9. I was told to use == instead of = but when I do use == nothing displays. If you can help me what I'm doing wrong I would appreciate it a lot. Also another thing is when I enter 95014 the check digit is 1 but it doesn't output the info for 1 instead it outputs the info for 9. Which is strange because when I input 4445 the check digit also equals 1 and it does display the correct output. Can you also explain why this is happening?
Change if (ch[i] = 9) and each of the following ones, down to the 0, to if (ch[i] == '9')
The array, ch is a char array, not int, plus you are assigning the the single =, not comparing, as with a double equal. ==.