#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++)
{
;
}
sentence[i]=’\0′;
count = i; /*shows the number of chars accepted in a sentence*/
printf(“The given sentence is : %s”,sentence);
printf(“\nCase changed 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
My Name is C
The given sentence is : My Name is C
Case changed sentence is: mY nAME IS c
————————————————*/
Not Satisfied ? Just search & get the result
Related posts:
- Sample – Program to enter a sentence and output the number of uppercase & lowercase consonants, uppercase & lowercase vowels in sentence..
- C program to read A (MxN), find the transpose of a given matrix and output both the input matrix and the transposed matrix.
- C program to find the sum of odd numbers and sum of even numbers from 1 to N. Output the computed sums on two different lines with suitable headings
- C program to read two matrices A (MxN) and B(MxN) and perform addition OR subtraction of A and B. Find the trace of the resultant matrix. Output the given matrix, their sum or Differences and the trace.
- C program to read two strings and concatenate them (without using library functions). Output the concatenated string along with the given string
