[Solved] Overwhelmed with how to accomplish program


You can try this …

printf("Please enter a character or characters ");
while (c !='\n') {
    c = getch();

    // Check for a digit
    if isdigit(c){
        sum += c - '0';
        continue;
    }

    // If lowercase, convert to upper case
    if islower(c) c = toupper(c);
    if isupper(c) putchar(c);

}

EDIT:

Actually the continue isnt necessary because we are checking what we print …

printf("Please enter a character or characters ");
while (c !='\n') {
    c = getch();

    // Check for a digit
    if isdigit(c) sum += c - '0';

    // If lowercase, convert to upper case
    if islower(c) c = toupper(c);
    if isupper(c) putchar(c);

}

7

solved Overwhelmed with how to accomplish program