bsc

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

root / semester_1 / letusc / luc073.c

luc073.c (973B)


      1 /* Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long.
      2 */
      3 
      4 /* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(b) */
      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 main()
     16 {
     17     char str[81], res[81];
     18     int i, j = 0;
     19 
     20     printf("Enter a sentence (max 80 chars): ");
     21     gets(str); // Note: gets is deprecated, but used here for simplicity as per classic C texts
     22 
     23     for (i = 0; str[i] != '\0'; i++)
     24     {
     25         char ch = tolower(str[i]);
     26         if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
     27         {
     28             // Skip vowel
     29             continue;
     30         }
     31         else
     32         {
     33             res[j] = str[i];
     34             j++;
     35         }
     36     }
     37     res[j] = '\0';
     38 
     39     printf("Sentence without vowels: %s\n", res);
     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