Answer:
def is_vow(c):
# this compares vowel with
# character 'c'
return ((c == 'a') or (c == 'e') or
(c == 'i') or (c == 'o') or
(c == 'u'));
# function to print resultant string
def removeVowels(str):
# print 1st character
print(str[0], end = "");
# loop to check for each character
for i in range(1,len(str)):
# comparison of consecutive
# characters
if ((is_vow(str[i - 1]) != True) or
(is_vow(str[i]) != True)):
print(str[i], end = "");
# Driver code
str= " geeks for geeks";
removeVowels(str);
Explanation:
#include<stdio.h>
// function will check for a vowel
int checkVowel(char ch)
{
if((ch=='A') || (ch=='E') || (ch=='I') || (ch=='O') || (ch=='U') || (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++;
// to get the position of consecutive vowels
printf("positions of consecutive vowels :%d & %d \n", i+1,i+2);
if (consecutiveVowel==0)
printf (" Not found");
printf("Total Consecutive Vowel = %d\n",consecutiveVowel);
For more similar type problem, click here:
https://brainly.in/question/9302486
https://brainly.in/question/12661385
Copyright © 2024 EHUB.TIPS team's - All rights reserved.
Answers & Comments
Answer:
def is_vow(c):
# this compares vowel with
# character 'c'
return ((c == 'a') or (c == 'e') or
(c == 'i') or (c == 'o') or
(c == 'u'));
# function to print resultant string
def removeVowels(str):
# print 1st character
print(str[0], end = "");
# loop to check for each character
for i in range(1,len(str)):
# comparison of consecutive
# characters
if ((is_vow(str[i - 1]) != True) or
(is_vow(str[i]) != True)):
print(str[i], end = "");
# Driver code
str= " geeks for geeks";
removeVowels(str);
Answer:
Explanation:
#include<stdio.h>
// function will check for a vowel
int checkVowel(char ch)
{
if((ch=='A') || (ch=='E') || (ch=='I') || (ch=='O') || (ch=='U') || (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++;
// to get the position of consecutive vowels
printf("positions of consecutive vowels :%d & %d \n", i+1,i+2);
}
}
}
if (consecutiveVowel==0)
printf (" Not found");
else
printf("Total Consecutive Vowel = %d\n",consecutiveVowel);
return 0;
}
For more similar type problem, click here:
https://brainly.in/question/9302486
https://brainly.in/question/12661385