Ticker

6/recent/ticker-posts

C Language (Program to convert small to caps and caps to small)

C PROGRAM TO CONVERT SMALL TO CAPS AND CAPS TO SMALL LETTERS




#include<stdio.h>
#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















Post a Comment

0 Comments