Computer Science, asked by neha1234532, 1 year ago

write a program to input a word and count number of vowels

Answers

Answered by BrainlyTech
5

Hello Friend

I'm here to help you with your question.

I'm going to shorten it out but hopefully it's enough.

#include <stdio.h>



int main()


{


   char line[150];


   int i, vowels, consonants, digits, spaces;


    vowels =  consonants = digits = spaces = 0

   printf("Enter a line of string: ");


   scanf("%[^\n]", line);


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


   {


    if(line[i]=='a' || line[i]=='e' || line[i]=='i' ||


    line[i]=='o' || line[i]=='u' || line[i]=='A' ||


    line[i]=='E' || line[i]=='I' || line[i]=='O' ||


    line[i=='U')


       {


      ++vowels;


       }


       else if((line[i]>='a'&& line[i]<='z') || (line[i]>='A'&& line[i]<='Z'))


       {


           ++consonants;


       }


       else if(line[i]>='0' && line[i]<='9')


       {


           ++digits;


       }


       else if (line[i]==' ')


       {


      ++spaces;


       }


   }

 return 0;

}

I'ma take a break from typing.

My fingers hurt :(

Hopefully this helps you!

If not let me know.

Have a good day friend.

\boxed{ Be Brainly Friend! }


BrainlyTech: Btw i didnt type the rest because my fingers are hurting but i hope that is enough. :)
neha1234532: yes
neha1234532: thankyou
BrainlyTech: No problem! I'm glad I could help but yh im bout to take a break lol
Similar questions