diff --git a/C/program-56/README.md b/C/program-56/README.md new file mode 100644 index 00000000..cdda9057 --- /dev/null +++ b/C/program-56/README.md @@ -0,0 +1,4 @@ +Program 56 + + +Write a program in C to calculate the number of vowels and consonants in a string. diff --git a/C/program-56/program.c b/C/program-56/program.c new file mode 100644 index 00000000..12d30de1 --- /dev/null +++ b/C/program-56/program.c @@ -0,0 +1,15 @@ +#include + +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)); +}