#include <stdio.h>

main()
{
    char input='a';
    
    do {
	    printf ("Enter one char or x to exit: ");
    } while (scanf ("\n%c", &input) && input != 'x');   


    /* Read input */
    while (1) { 
	
	    printf ("\nEnter char or x to exit: \n");

	    if ((scanf ("\n%c", &input) <= 0) || (input == 'x'))
	        break;
	        
	        /* Check alphanum */
	    if (input >= '0' && input <= '9') {
	        printf ("It's a digit \n");
	    }
	    else if (input >= 'a' && input <= 'z') {
	        printf ("Lower case alpha \n");
	    }
	    else if (input >= 'A' && input <= 'Z') {
	        printf ("Upper case alpha \n");
	    }
	}

    printf ("Enter a char to get its ascii: \n");
    scanf ("\n%c", &input);
    int i=0;
	for (i = 0; i < (unsigned char) -1 ; i++) {
	    printf ("#");
	    if (i == input) {
		printf ("\nYour input %c equals %i, ASCII value %d \n", 
			input, i, input);
		break;
	    }
	}
	printf ("Looped %d times\n", i);

}
