C Program – Count the number of vowels in a given string

by Nideesh C on April 18, 2011 · 0 comments

in C Programming




#include<stdio.h>
#include<conio.h>
void main()
{
char str[50];
int vowels = 0, i = 0;
clrscr();
printf(“nnt ENTER A STRING…: “);
gets(str);
while(str[i] != ‘′)
{
if(str[i]==’A’ || str[i]==’a’ || str[i]==’E’ || str[i]==’e’ || str[i]==’I’ || str[i]==’i’ ||
str[i]==’O’ || str[i]==’o’ || str[i]==’U’ || str[i]==’u’)
vowels++;
i++;
}
printf(“nnt THE TOTAL NUMBER OF VOWELS IS…: %d”, vowels);
getch();
}

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program read a sentence and count the number of number of vowels and consonants in the given sentence. Output the results on two lines with suitable headings
  2. C Program – Find the total number of palindrome in a given string
  3. C program to accept a string and find the number of times the word ‘the’ appears in it
  4. C program – To check whether the given string is palindrome
  5. Sample – Program to enter a sentence and output the number of uppercase & lowercase consonants, uppercase & lowercase vowels in sentence..

Leave a Comment

Previous post:

Next post: