#include <stdio.h>
char to_lower(char letter);
int main(void)
{
char input;
printf("Please input a letter: \n");
scanf("%c", &input);
printf("%c's lowercase is %c\n", input, to_lower(input));
return 0;
}
char to_lower(char letter)
{
if (letter >= 'A' && letter <= 'Z') {
return letter + 32; // Convert to lowercase by adding 32
} else {
return '\0'; // Return null character if not uppercase
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter