Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
97 views

C Program To Convert Lowercase To Uppercase and Vice Versa - Programming Spark

This document contains a C program to convert strings between lowercase and uppercase. The program takes a string as input, then iterates through each character and checks if it is uppercase or lowercase by comparing its ASCII value. If uppercase, it subtracts 32 to convert to lowercase, and if lowercase it adds 32 to convert to uppercase. Finally it prints out the converted string.

Uploaded by

Kishor Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

C Program To Convert Lowercase To Uppercase and Vice Versa - Programming Spark

This document contains a C program to convert strings between lowercase and uppercase. The program takes a string as input, then iterates through each character and checks if it is uppercase or lowercase by comparing its ASCII value. If uppercase, it subtracts 32 to convert to lowercase, and if lowercase it adds 32 to convert to uppercase. Finally it prints out the converted string.

Uploaded by

Kishor Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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