Computer Science, asked by substud09, 9 months ago

Write a program to read a file and count and print only vowels store in it.

Answers

Answered by nasaarjunsoni
1

Answer:

#include <stdio.h>

int main() {

   char line[150];

   int vowels, consonant, digit, space;

   vowels = consonant = digit = space = 0;

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

   fgets(line, sizeof(line), stdin);

   for (int 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')) {

           ++consonant;

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

           ++digit;

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

           ++space;

       }

   }

   printf("Vowels: %d", vowels);

   printf("\nConsonants: %d", consonant);

   printf("\nDigits: %d", digit);

   printf("\nWhite spaces: %d", space);

   return 0;

}

Answered by BrainlyEmpire
2

Answer:

.

.

.

.

Phonics is a method for teaching the reading and writing of an alphabetic language (such as English, Arabic and Russian). It is done by demonstrating the relationship between the sounds (phonemes) of the spoken language, and the letters (graphemes), groups of letters, or syllables of the written language. This is also known as the Alphabetic principle or the Alphabetic code.

Similar questions