#include<string.h>
#include<conio.h>
void main()
{
clrscr();
char s[60];
int L, i;
puts("Enter any sentence: ");
gets(s);
L=strlen(s);
// Loop to count small and caps letters
for(i=0; i<L; i++)
{
if(s[i] >= 65 && s[i] <= 90)
{
s[i] = s[i] + 32;
}
else if(s[i] >= 97 && s[i] <= 122)
{
s[i] = s[i] - 32;}
}
// Print string after changes.
puts(s);
getch();
}
----------------------------
OUTPUT
----------------------------
Enter any sentence:
Once upon A Time
oNCE uPON a tIME
No comments:
Post a Comment