top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a C program to find the consecutive occurrence of any vowel in a string?

0 votes
7,675 views
Write a C program to find the consecutive occurrence of any vowel in a string?
posted Jun 27, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
#include<stdio.h>
int checkVowel(char ch)
{
        ch=toupper(ch);
        if((ch=='A') || (ch=='E') || (ch=='I') || (ch=='O') || (ch=='U'))
                return 1;
        else
                return 0;
}
int main()
{
        char str[100];
        printf("Enter string : ");
        scanf("%[^\n]",str);
        int i,strlen,consecutiveVowel=0;
        for(i=0;str[i];i++);
        strlen=i;
        for(i=0;i<strlen-1;i++)
        {
                if(checkVowel(str[i]))
                {
                        if(checkVowel(str[i+1]))
                        {
                                consecutiveVowel++;
                        }
                }
        }
        printf("Total Consecutive Vowel = %d\n",consecutiveVowel);
        return 0;
}
answer Jun 27, 2017 by Chirag Gangdev
very smart and easy way to make program
Similar Questions
0 votes

Enter character: r
Enter string: programming
Output: Positions of 'r' in programming are: 2 5
Character 'r' occurred for 2 times

+2 votes

Output
Enter the string: Welcome to C Class!
Enter the word to insert: programming
Enter the position you like to insert: 3
The string after modification is

Welcome to C programming Class!

–1 vote

Write a C program to check if the given string is repeated substring or not.
ex
1: abcabcabc - yes (as abc is repeated.)
2: abcdabababababab - no

+3 votes
...