Monday, March 26, 2012

Program to calculate the frequency of vowles in a given string in C code


/*****************<soeasyprograms.blogspot.in>******************/
/* program to calculate the frequency of vowels in a given string*/

#include<stdio.h>
#include<conio.h>
main()
{
           int i,vow=0;
           char cstr[100];
           clrscr();
           printf(" enter the string of ur choice : ");
           gets(cstr);
           i=0;
           while(cstr[i]!='\0')
           {
                    if(cstr[i]=='a'||cstr[i]=='e'||cstr[i]=='i'||cstr[i]=='o'||cstr[i]=='u')
                   {
                    vow++;
                    }
                    else if(cstr[i]=='A'||cstr[i]=='E'||cstr[i]=='I'||cstr[i]=='O'||cstr[i]=='U')
                    {
                    vow++;
                    }
               i++;
           }
          printf(" \n the no of vowels are: %d",vow);
          getch();
}
       /*End of program*/
/*****************<soeasyprograms.blogspot.in>******************/


No comments:

Post a Comment