Convert Text to Uppercase and Lowercase with strupr() and strlwr()
strupr()
strupr() converts a string into uppercase. strlwr() is useful to convert a string into lowercase.
Example: to convert string into upper and lower case, we can write:
strupr(string);
strlwr(string);
Program to convert a string into uppercase and lowercase
#include<stdion.h>
#include<string.h>
void main()
{
char string[100];
printf("\nEnter a string:");
gets(string);
puts("\n uppercase");
puts(strupr(string));
puts("\n lowercase");
puts(strlwr(string));
}
Output:
Enter a string: Nav Tutorials
In uppercase: NAV TUTORIALS
In lowecase: nav tutorials