#include <stdio.h>
#include <conio.h>
void lower_to_upper();
void upper_to_lower();
void main()
{
int n;
clrscr();
printf("Please
enter your choice.");
printf("(1) for
upper to lower conversion.");
printf("(2) for lower
to upper conversion.");
printf("CHOICE:- ");
scanf("%d",&n);
switch (n)
{
case 1:
printf("Please enter a string in upper
case.");
printf("String will be terminated
if you press Ctrl-Z.");
printf("STRING:- ");
upper_to_lower();
break;
case 2:
printf("Please enter a string in lower case.");
printf("String will be terminated if you press Ctrl-Z.");
printf("STRING:- ");
lower_to_upper();
break;
default:
printf("ERROR");
}
printf("HAVE A
NICE DAY! BYE.");
getch();
}
void upper_to_lower()
{
int i,j;
char c4[80],c3;
for
(i=0;(c3=getchar())!=EOF;i++)
c4[i]=(c3>='A'
&& c3<='Z')?('a' + c3 -'A'):c3;
printf("The lower case
equivalent is ");
for
(j=0;j<i;j++)
putchar(c4[j]);
return;
}
void lower_to_upper()
{
int i,j;
char
c2[80],c1;
for
(i=0;(c1=getchar())!=EOF;i++)
c2[i]=(c1>='a' && c1<='z')?('A' + c1 -'a'):c1;
printf("The upper case equivalent is ");
for
(j=0;j<i;j++)
putchar(c2[j]);
return;
}
OUTPUT:
(1) for upper to lower conversion.
(2) for lower to upper conversion.
CHOICE:- 1
Please enter a string in upper case.
String will be terminated if you press Ctrl-Z.
STRING:- FIRSTSOFT TECH^Z
The lower case equivalent is
firstsoft tech
HAVE A NICE DAY! BYE.
Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com