/*Q2 Programme to count no of upper case lower case digits and special characters */
#include<stdio.h>
void main()
{
char str[100];
int i,c1=0,c2=0,c3=0,c4=0;
printf("\n Enter your string ");
gets(str);
for(i=0 ; str[i]!='\0' ; i++)
{
if(str[i]>='A' && str[i]<='Z') // if(str[i]>=65 && str[i]<=90)
c1++;
else
if(str[i]>='a' && str[i]<='z') //if(str[i]>=97 && str[i]<=122)
c2++;
else
if(str[i]>='0' && str[i]<='9') //if(str[i]>=48 && str[i]<=57)
c3++;
else
c4++;
}
printf("\nUpper case is: %d ",c1);
printf("\nLower case is: %d",c2);
printf("\nDigit is: %d",c3);
printf("\nSpecial Character is: %d",c4);
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='A'||str[i]=='E'||str[i]=='I
'||str[i]=='O'||str[i]=='U')
c1++;
else
c2++;
}
printf("\n Vowels are=%d",c1);
printf("\n Conconents are=%d",c2);
/*Q4 Programme to Convert upper case to lower case lower to upper case*/
#include<stdio.h>
void main()
{
char str[100];
int i,c1=0,c2=0;
printf("\n Enter your string ");
gets(str);
for(i=0;str[i]!='\0';i++)
{
if(str[i]>=65 && str[i]<=90)
str[i]=str[i]+32;
else
str[i]=str[i]-32;
}
printf("\n Output=%s",str);