Untitled

 avatar
unknown
plain_text
2 years ago
531 B
4
Indexable
#include <stdio.h>
#include <string.h>

int main() {
    char input[100], output[100];
    int i, j = 0;
    
    printf("Enter a string: ");
    fgets(input, sizeof(input), stdin);
    input[strcspn(input, "\n")] = '\0'; // remove newline character
    
    for(i = 0; input[i] != '\0'; i++) {
        if(input[i] >= 'A' && input[i] <= 'Z') { // check if uppercase letter
            output[j++] = input[i];
        }
    }
    output[j] = '\0';
    
    printf("Result: %s\n", output);
    
    return 0;
}
Editor is loading...