luc073.c (1164B)
1 /* 2 * Author : Amit Dutta <amitdutta4255@gmail.com> 3 * Date : 08 Feb 2026 4 * Repo : https://github.com/notamitgamer/bsc 5 * License : MIT License (See the LICENSE file for details) 6 */ 7 8 /* Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long. 9 */ 10 11 /* Let Us C, Chap- 16 (Handling Multiple Strings), Qn No.: A(b) */ 12 13 /* This file is auto-generated by a bot. */ 14 /* This code is not compiled; it is for reference only. */ 15 16 17 #include <stdio.h> 18 #include <string.h> 19 #include <stdlib.h> 20 #include <ctype.h> 21 22 int main() 23 { 24 char str[81], res[81]; 25 int i, j = 0; 26 27 printf("Enter a sentence (max 80 chars): "); 28 gets(str); // Note: gets is deprecated, but used here for simplicity as per classic C texts 29 30 for (i = 0; str[i] != '\0'; i++) 31 { 32 char ch = tolower(str[i]); 33 if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') 34 { 35 // Skip vowel 36 continue; 37 } 38 else 39 { 40 res[j] = str[i]; 41 j++; 42 } 43 } 44 res[j] = '\0'; 45 46 printf("Sentence without vowels: %s\n", res); 47 48 return 0; 49 }