1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <stdio.h> #include <cs50.h> #include <string.h> int main(void) { string s = get_string("Before: "); printf("After: "); for (int i = 0; i < strlen(s); i++) { if (s[i] >= 'a' && s[i] <= 'z') { printf("%c", s[i] - 32); } else { printf("%c", s[i]); } } printf("\n"); }