C Program | Count Small Capital Letter Digits Speical Character of an email id
Write a Code on C Program Count Character of an email id :
Code:
#include<stdio.h>
#include<string.h>
void main()
{
int l,i,small,capital,digit,special;
char s[100];
printf("Enter an email id:\n");
gets(s);
l=strlen(s);
small=0,capital=0,digit=0,special=0;
for(i=0;i<l;i++)
{
if(s[i]>='a' && s[i]<='z')
small++;
else if(s[i]>='A' && s[i]<='Z')
capital++;
else if(s[i]>='0' && s[i]<='9')
digit++;
else
special++;
}
printf("In string small= %d , capital= %d , digit=%d , special= %d\n",small,capital,digit,special);
}
Comments
Post a Comment
Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)