include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
void main()
{
char str[30];
int i,dig=0,low=0,up=0,sp=0;
clrscr();
printf("Enter string : ");
gets(str);
for(i=0;i<strlen(str);i++)
{
if(str[i]>='0'&&str[i]<='9')
dig++;
else if(str[i]>='a'&&str[i]<='z')
low++;
else if(str[i]>='A'&&str[i]<='Z')
up++;
else
sp++;
}
printf("
digits : %d
lower case letters : %d
upper case letters :
%d
special characters : %d",dig,low,up,sp);
getch();
}
Comments
Leave a comment