c program for 5 function of vowels cntwords


C Program for 5 FUNCTION OF VOWELS, CNT_WORDS, REVERSE

void input(char a[]);

void output(char a[]);

void reverse(char a[], char b[]);

char poli(char a[], char b[]);

int count(char a[], int l[]);

void vowels(char a[]);

void main()

{

          char a[30],b[30],j;

          int i,k=0,l[30];

          clrscr();

 

          for(i=0;i<30;i++)

          {

                   a[i]='0';

                   b[i]='0';

                   l[i]=0;

          }

          input(a);

          output(a);

          reverse(a,b);

          j=poli(a,b);

          k=count(a,l);

          vowels(a);

          printf("\n\nTHE NO OF WORDS IN STRING ARE %d\n\n",k);

          if(j=='e')

          {

                   printf("\n\nIT IS PALINDROME");

          }

          else

          {

                   printf("\n\nIT IS NOT PALINDROME");

          }

          getch();

}

 

 

void input(char a[])

{

          int i=0;

          printf("ENTER THE STRING= ");

          do

          {

                   a[i++]=getchar();

 

          }while(a[i-1]!='\n');

          a[i-1]='\0';

}

void output(char a[])

{

          int i=0;

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

          {

                   printf("%c",a[i]);

          }

          printf("\n\n");

}

void reverse(char a[],char b[])

 

{

          int i=0,j=0;

          i=strlen(a);

          i=i-1;

          for(;i!=-1;i--)

          {

                   b[i]=a[j++];

                   printf("%c",a[i]);

          }

}

char poli(char a[], char b[])

{

          int i=0;

          char j='e';

 

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

          {

                   if(a[i]!=b[i])

                   {

                             j='n';

                             break;

                   }

          }

          return(j);

}

int count(char a[], int l[])

{

          int i=0,k=0,c=0;

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

          {

                   if(a[i]==' ')

                   {

                             k++;  c++;

                   }

 

else

                             l[c]=l[c]+1;

          }

          c=1;

          printf("\n\n");

          for(i=0;l[i]!=0;i++)

          {

printf("THE NO OF CHARACTERS IN %d WORD ARE %d\n",c,l[i]);

                   c++;

          }

          k++;

          return(k);

}

void vowels(char a[])

{

          int j=0,a1=0,e=0,i=0,o=0,u=0,l[30],c=0;

          for(j=0;j<30;j++)

                   l[j]=0;

          for(j=0;a[j]!='\0';j++)

          {

                   if(a[j]=='a' || a[j]=='A')

                   {

                             a1++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='e' || a[j]=='E')

                   {

                             e++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='i' || a[j]=='I')

                   {

                             i++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='o' || a[j]=='O')

                   {

                             o++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='u' || a[j]=='U')

                   {

                             u++;

                             l[c++]=j+1;

                   }

          }

          printf("THE NO OF VOWELS \"a\" AND \"A\" ARE %d\n",a1);

          printf("THE NO OF VOWELS \"e\" AND \"E\" ARE %d\n",e);

          printf("THE NO OF VOWELS \"i\" AND \"I\" ARE %d\n",i);

          printf("THE NO OF VOWELS \"o\" AND \"O\" ARE %d\n",o);

          printf("THE NO OF VOWELS \"u\" AND \"U\" ARE %d\n",u);

}

 

OUTPUT :

ENTER THE STRING:

SHIVANI PRERNA SHRIDEVI VIRAL KAMLESH  

HSELMAK LARIV IVEDIRHS ANRERP INAVIHS

THE NO OF CHAR IN 1 WORD ARE 7

THE NO OF CHAR IN 1 WORD ARE 6

THE NO OF CHAR IN 1 WORD ARE 8

THE NO OF CHAR IN 1 WORD ARE 5

THE NO OF CHAR IN 1 WORD ARE 7

 

 

OUTPUT :

THE NO OF VOWELS A  2

THE NO OF VOWELS E  3

THE NO OF VOWELS  I  5

THE NO OF VOWELS O  0

THE NO OF VOWELS U  0

THE NO OF WORDS IN THE STRING 5

IT IS NOT PALINDROM

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: c program for 5 function of vowels cntwords
Reference No:- TGS0159420

Expected delivery within 24 Hours