© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

C Program For Case Conversion

#include #include 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='a' && c1<='z')?('A' + c1 -'a'):c1; printf("The upper case equivalent is "); for (j=0;j

Sample Output :

Please enter your choice.
(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.

 
SLogix Student Projects
bottom