Answer to Question #292704 in C for Kumar

Question #292704

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



1
Expert's answer
2022-02-01T05:54:27-0500


#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();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS