Hi all,
I had recently been given an assignment, in which I was asked to write a C program that1. prompts the user to enter two character values;2. prints out the sequence of characters between the two values (inclusive). I solved this with the following code:
Now I have been asked to add a feature in which the two characters are entered is not significant. Therefore,regardless of whether the higher or lower character is the first entered the sequence isstill displayed in ascending order from the lowest to the highest.Code:#include <stdio.h> int main() { char A = 0, B = 0; printf("enter two values: "); scanf("%c%c", &A, &B); while(A <= B) printf("%c %c ", A++,); return 0; }
Could anyone give me some tips on how to achieve this?
Thanks in advance!