19/*Write a ‘C’ program to accept string from user and convert all lower case letters into upper case letters and vice versa*/


#include<stdio.h>
#include<conio.h>
void main()
{
char a[30],b[30],ch,s;
int i;
clrscr();
printf(“\n Enter the string:”);
gets(a);
for(i=0;a[i]!=”;i++)
{
ch=a[i];
s=’A’;
if(ch==32)
ch=32;
else
if(ch>’A’&&ch<=’Z’)
ch=ch+32;
else
if(ch!=s)
ch=ch-32;
b[i]=ch;
}
b[i]=”;
printf(“Converted String is:%s”,b);
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s