AedenCak3

C program to count number of vowels in a string

Dec 8th, 2021
974
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     char a[100];
  6.     int vowel=0, i;
  7.  
  8.     printf("Write a sentence: \n");
  9.     gets(a);
  10.  
  11.     for(i=0; a[i]!='\0'; i++)
  12.     {
  13.         if
  14.            ( a[i]== 'a' || a[i]== 'e' ||a[i]== 'i' ||a[i]== 'o' ||a[i]== 'u' || a[i]== 'A' ||a[i]== 'E' ||a[i]== 'I' ||a[i]== 'O' ||a[i]== 'U' )
  15.            {
  16.                vowel++;
  17.            }
  18.  
  19.            }
  20.        printf("The number of  vowels are : %d" , vowel);
  21.  
  22.  
  23.     return 0;
  24. }
  25.  
RAW Paste Data