C Program to convert the lower case letters to upper case and vice-versa

by Nideesh C on April 13, 2011 · 0 comments

in C Programming




//Downloaded From theonlinetutorials.com

//C Program to convert the lower case letters to upper case and vice-versa 

#include <stdio.h>
#include <ctype.h>
#include <conio.h>

void main()
{
char sentence[100];
int count, ch, i;
clrscr();

printf("Enter a sentence\n");
for(i=0; (sentence[i] = getchar())!='\n'; i++)
{
;
}
count = i;

printf("\nInput sentence is     : %s ",sentence);

printf("\nResultant sentence is : ");
for(i=0; i < count; i++)
{
ch = islower(sentence[i]) ? toupper(sentence[i]) : tolower(sentence[i]);
putchar(ch);
}

}     /*End of main()

/*-----------------------------------------
Output
Enter a sentence
gOOD mORNING

Input sentence is     : gOOD mORNING

Resultant sentence is :Good Morning
------------------------------------------*/



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to read an English sentence and replace lowercase characters by uppercase and vice-versa. Output the given sentence as well as the case converted sentence on two different lines.
  2. C program read a sentence and count the number of number of vowels and consonants in the given sentence. Output the results on two lines with suitable headings
  3. Sample – Program to convert temperatures from Celsius to Fahrenheit and vice versa.
  4. C program to generate and print first N FIBONACCI numbers
  5. C program to accept a string and find the sum of all digits present in the string

Leave a Comment

Previous post:

Next post: