Showing posts with label consonant. Show all posts
Showing posts with label consonant. Show all posts

c program to count vowel, consonant, arithmetic operator, special character, word and sentence from a multiple line string

Write a c program to count vowel, consonant, arithmetic operator, special character, word and sentence from a string in a file and save the output in another file

<< Go to Index Page >>

c program to count vowel and consonant

Write a c program to count vowel and consonant from a given string as like "I love Bangladesh"

#include<stdio.h>

main(){

int i , con=0 , vow=0 , space=0 , sentence=0;
char ch[]="i love bangladesh.";

for(i=0;ch[i]!='\0';i++){

if(ch[i]=='A' || ch[i]=='a' || ch[i]=='E' || ch[i]=='e' || ch[i]=='I' || ch[i]=='i' || ch[i]=='O' || ch[i]=='o' || ch[i]=='U' || ch[i]=='u'){
vow++;
}
else if(ch[i]==' '){
space++;
}
else if(ch[i]=='.'){
sentence++;
}
else{
con++;
}
}
printf("number of consonant is : %d \n",con);
printf("number of vowel is : %d \n",vow);
}


<< Go to Index Page >>