Character Input and Output

#include <stdio.h>

int main() {
    // Character input and output
    char ch;

    printf("Enter a character: ");
    scanf(" %c", &ch);  // Note the space before %c to consume any leading whitespace

    printf("You entered: %c\n", ch);

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website