Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions C/program-56/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Program 56


Write a program in C to calculate the number of vowels and consonants in a string.
15 changes: 15 additions & 0 deletions C/program-56/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdio.h>

int main() {
char ch[100];
int i,count;
printf("Enter the string \n");
fgets(ch,100,stdin);
for(i=0;ch[i]!='\0';i++)
{
if(ch[i]=='a'||ch[i]=='e'||ch[i]=='i'||ch[i]=='o'||ch[i]=='u'||ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U')
count++;
}
printf("Number of vowels are %d \n",count);
printf("Number of consonants are %d",(i-count));
}