bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc076.c

luc076.c (898B)


      1 /* Write a program to count the number of occurrences of any two vowels in succession in a line of text.
      2 */
      3 
      4 /* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(e) */
      5 
      6 /* This file is auto-generated by a bot. */
      7 /* This code is not compiled; it is for reference only. */
      8 
      9 
     10 #include <stdio.h>
     11 #include <string.h>
     12 #include <stdlib.h>
     13 #include <ctype.h>
     14 
     15 int is_vowel(char c)
     16 {
     17     c = tolower(c);
     18     return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
     19 }
     20 
     21 int main()
     22 {
     23     char str[100];
     24     int i, count = 0;
     25 
     26     printf("Enter a line of text: ");
     27     gets(str);
     28 
     29     printf("Occurrences found:\n");
     30     for (i = 0; str[i] != '\0'; i++)
     31     {
     32         if (is_vowel(str[i]) && is_vowel(str[i+1]))
     33         {
     34             printf("'%c%c' ", str[i], str[i+1]);
     35             count++;
     36         }
     37     }
     38 
     39     printf("\n\nTotal number of successive vowels: %d\n", count);
     40 
     41     return 0;
     42 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror