C PROGRAM TO COUNT SMALL AND CAPS 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)
{
sm=sm+1;
}
else if(s[i] >= 97 && s[i] <= 122)
{
cp=cp+1;}
}
printf("\nNumber of small letters are : %d", sm);
printf("\nNumber of caps letters are : %d", c);
getch();
}----------------------------
OUTPUT
----------------------------
Enter any sentence:
Once Upon A Time
Number of small letters are: 4
Number of caps letters are: 9
0 Comments