/*---------------------------------------------------------------------------
PROGRAM TO COUNT THE NUMBER OF VOWELS IN A GIVEN STRING
Program by http://electrofriends.com
Copyrights (c) 2005-2007 electrofriends.com, All rights reserved.
---------------------------------------------------------------------------*/
#include<stdio.h>
#include<conio.h>
void main()
{
char str[50];
int vowels = 0, i = 0;
clrscr();
printf("\n--------------------------------------------------------");
printf("\n\nPROGRAM TO COUNT THE NUMBER OF VOWELS IN A GIVEN STRING");
printf("\n\n--------------------------------------------------------");
printf("\n\n\t ENTER A STRING...: ");
gets(str);
while(str[i] != '\0')
{
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("\n\n\t THE TOTAL NUMBER OF VOWELS IS...: %d", vowels);
printf("\n\n-------------------------------------------------------");
getch();
}
PROGRAM TO COUNT THE NUMBER OF VOWELS IN A GIVEN STRING
Program by http://electrofriends.com
Copyrights (c) 2005-2007 electrofriends.com, All rights reserved.
---------------------------------------------------------------------------*/
#include<stdio.h>
#include<conio.h>
void main()
{
char str[50];
int vowels = 0, i = 0;
clrscr();
printf("\n--------------------------------------------------------");
printf("\n\nPROGRAM TO COUNT THE NUMBER OF VOWELS IN A GIVEN STRING");
printf("\n\n--------------------------------------------------------");
printf("\n\n\t ENTER A STRING...: ");
gets(str);
while(str[i] != '\0')
{
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("\n\n\t THE TOTAL NUMBER OF VOWELS IS...: %d", vowels);
printf("\n\n-------------------------------------------------------");
getch();
}
No comments:
Post a Comment