majuscule en c

Code for Converting Lowercase to Uppercase in C

#include <stdio.h>
#include <ctype.h>

int main() {
    char lowercase, uppercase;

    printf("Enter a lowercase letter: ");
    scanf("%c", &lowercase);

    uppercase = toupper(lowercase);

    printf("Uppercase: %c", uppercase);

    return 0;
}

Explanation:

  • The #include <stdio.h> and #include <ctype.h> are header files included for input/output and character handling functions respectively.
  • The main function is the entry point of the program.
  • char lowercase, uppercase; declares two variables to store the lowercase and uppercase characters.
  • printf("Enter a lowercase letter: "); prompts the user to enter a lowercase letter.
  • scanf("%c", &lowercase); reads the input lowercase character from the user.
  • uppercase = toupper(lowercase); converts the lowercase character to uppercase using the toupper function from the ctype.h library.
  • printf("Uppercase: %c", uppercase); displays the uppercase character.
  • return 0; indicates successful execution of the program.