#include<stdio.h>
#include<conio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
{
void main ()
char *st;
int i, l, vowel=0, cons=0, digit=0, space=0, other=0;
st=(char *)malloc(sizeof(char)*100);
clrscr ();
printf("Enter any line of text: ");
gets (st);
l=strlen (st);
for(i=0; i<l; i++)
if (*st [i]=='a'||*st[i]=='e'||*st[i]=='0'||*st[i]=='u’||*st[i]==”A” ||*st[i]=='E’||*st[i]=='I’||*st[i]=='0'||*st [i]=='u')
clrscr ();
printf("Enter any line of text: ");
gets (st);
l=strlen (st);
for(i=0; i<l; i++)
if (*st [i]=='a'||*st[i]=='e'||*st[i]=='0'||*st[i]=='u’||*st[i]==”A” ||*st[i]=='E’||*st[i]=='I’||*st[i]=='0'||*st [i]=='u')
vowel++;
else if(st[i]>='A'||st[i]<='Z')
cons++;
else if(st[i]>='a'||st [i]<='z')
cons++;
else if(st[i]>='0'||st[i]<='9')
digit++;
else if(st[i]==' ')
space++;
else
other++;
printf("\nVowels %d", vowel);
printf("\nConsonants %d",cons);
printf("\nDigits %d", digit);
printf("\nSpaces %d", space);
printf ("\nOther %d", other);
getch();
}
else if(st[i]>='A'||st[i]<='Z')
cons++;
else if(st[i]>='a'||st [i]<='z')
cons++;
else if(st[i]>='0'||st[i]<='9')
digit++;
else if(st[i]==' ')
space++;
else
other++;
printf("\nVowels %d", vowel);
printf("\nConsonants %d",cons);
printf("\nDigits %d", digit);
printf("\nSpaces %d", space);
printf ("\nOther %d", other);
getch();
}
No comments:
Post a Comment