Kodewick
Start learning →
Basic←→0 / 70

Shout the sign

#040BasicStringsLoops4 min

The bakery's sign looks better in capitals. Change each lower-case letter in sign to upper case (leave the space alone); then it gets printed. Do it without toupper, using how far the letter is from 'a'.

Should show
FRESH BREAD
main.c
#include <stdio.h>

int main(void) {
    char sign[] = "fresh bread";
    for (int i = 0; sign[i] != '\0'; i++) {
        // your code here: if it is a lower-case letter, swap in its capital
    }
    printf("%s\n", sign);
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.