How to Write a c program to accept string from user & convert all lower case letters into upper case letters & vice versa in C Programming Language ?
Solution:/*C Program to accept string from user & convert all lower case letters into upper case letters & vice versa*/
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
void main()
{
char str[30];
clrscr();
printf("\nEnter the string: ");
gets(str);
printf("\nEntered string is: ");
puts(str);
if(isupper(str[0]))
{
strupr(str);
}
else
{
strlwr(str);
}
printf("\nThe converted string format is: %s",str);
getch();
}
//OUTPUT:
//Enter the string: vINIT
//Entered string is: vINIT
//The converted string format is: vinit