You are on page 1of 1

8/7/13

C program to convert lowercase to uppercase and vice versa | Programming Spark

Home

About & Contact

Archive

C Programming Examples

Search

29 May 2012

Categories:
C PR O GR AMS DATA STR UC TUR E PR O GR AMS DO YO U KNO W ? PATTER N PR O GR AMMING IN C PATTER N PR O GR AMMING IN C ++

C program to convert lowercase to uppercase and vice versa


Here is the program to convert the case i.e from lowercase to upper case and vice versa

program to conve rt the case

//#include<conio.h> #include<stdio.h> void main() { char str[20]; int i; clrscr(); printf("Enter any String "); scanf("%s",str); for(i=0;str[i]!='\0';i++) { if(str[i]>64&&str[i]<91) // Uppercase characters str[i]=str[i]+32; // adding 32 to change to lowercase else if(str[i]>95&&str[i]<122) // Lowercase characters str[i]=str[i]-32; // substracting 32 to change to Uppercase } printf("Here is the changed case: %s",str); getch(); }

STR INGS

+29 Recommend this on Google

Follow @rom ilshah91

11 follow ers

Popular Posts:
C program to implement circular Queue [using Array] Simple star pattern programs in c c program to concatenate two strings without using strcat [ using pointers] C Program to implement Singly Linked List C program to implement Stack [using Array] String functions in C with examples

Explanation: Easy program just

taking care of the Ascii values and and there case.

The differnce between Uppercase character and Lowercase character is 32.


www.programmingspark.com/2012/05/c-program-to-change-lowercase-to.html

1/3

You might also like