Find out the number of occurrence of vowels, characters and digits in the given statements
Input:
#$@aghte123
AqEtImU@123
xyz@12345
Output:
2 5 3
4 7 3
0 3 5
#include <stdio.h>
#include <conio.h>
void main()
{
char inputString[100];
int i,vowels=0,digits=0,characters=0;
gets(inputString);
for(i=0;inputString[i]!='\0';i++)
{
if(inputString[i]=='a' || inputString[i]=='e' || inputString[i]=='i' ||inputString[i]=='o' ||
inputString[i]=='u' || inputString[i]=='A' ||inputString[i]=='E' || inputString[i]=='I' ||
inputString[i]=='O' ||inputString[i]=='U')
{
vowels++;
}
else if(inputString[i]>='0' && inputString[i]<='9')
{
digits++;
}
else if(inputString[i]=='@')
{
}
else
{
characters++;
}
}
printf("%d %d %d\n\n",vowels,characters,digits);
getch();
}
Comments
Leave a comment