C program to calculate all Uppercase, Lowercase,digits and Symbols in given String.


#include<stdio.h>
#include<string.h>
int main()
{
char str[100];
int u=0,l=0,d=0,s=0,i;
printf("Enter any string:\n");
scanf("%s",str);
for(i=0;str[i]!='\0';i++)
{
   if(str[i]>='A' && str[i]<='Z')
    {
      u++;
    }
   else if(str[i]>='a' && str[i]<='z')
    {
      l++;
    }
    else if(str[i]>='0' && str[i]<='9')
    {
      d++;
    }
    else
    {
      s++;
    }
    }
   printf("\nUppercase characters are:%d\n",u);
   printf("\nLowercase characters are:%d\n",l);
   printf("\nDigits are:%d\n",d);
   printf("\nSymbols are:%d\n",s);
   return 0;
}

****INPUT && OUTPUT****



Post a Comment

0 Comments