Upper Case

Lab C Beginner 10 points

Read a line and print it in upper case using toupper in a loop.

Input

One line.

Output

One line.

Example

Input

Hello, World!

Output

HELLO, WORLD!
Sample input available Sample output available
Editor
C

Hints

Loop until the '\0' and change each character in place.

Solution explanation

C strings in arrays can be modified character by character.

Show solution
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char s[200];
    fgets(s, 200, stdin);
    s[strcspn(s, "\n")] = '\0';
    for (int i = 0; s[i] != '\0'; i++) {
        s[i] = toupper(s[i]);
    }
    printf("%s\n", s);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD