34. C Program To Learn how to convert lowercase letter to uppercase letter.
How does this program work?
- In this program your going to learn about how to scan a character.
- And converting lowercase letter into uppercase.
- By using string function we can easily convert lowercase to uppercase and viceversa.
Here is the code
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[100];
int i;
printf("\nEnter a string : ");
gets(s);
for (i = 0; s[i]!='\0'; i++)
{
if(s[i] >= 'a' && s[i] <= 'z')
{
s[i] = s[i] - 32;
}
}
printf("\nString in Upper Case = %s", s);
return 0;
}