Concatenate Vowels

 Concatenate Vowels 

 Problem Statement: 
The program must accept two string values S1 and S2 as the input. The program must concatenate S1 with the vowels in the string S2. Then the program must print the modified string value of S1 as the output. Fill in the lines so that the program runs successfully.
Note: S1 and S2 contains only lowercase alphabets.

 Boundary Condition(S): 
1 <= Length of S1, S2 <=100

 Input Format: 
The first line contains the string S1.
The second line contains the string S2.

 Output Format: 
The first line contains the modified string value of S1.

 Example Input/Output 1: 
 Input: 
netbeans
lion

 Output: 
netbeansio

 Explanation: 
The vowels in the string "lion" are i and o. So they are concatenated with the first string "netbeans". Hence the output is netbeansio.

 Example Input/Output 2: 
 Input: 
webapp
jakartaee

 Output: 
webappaaaee

 Note: Max Execution Time Limit: 4000 millisecs 

 Solution: 

 Programming Language: C Language 

#include <stdio.h>
#include <stdlib.h>
int main() {
    char str1[101],str2[101];
    scanf("%s%s",str1,str2);
    int i=strlen(str1);
    for(int j=0;str2[j]!='\0';j++){
        char ch=str2[j];
        if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
            str1[i]=ch;
            i++;
        }
    }
    str1[i]='\0';
    printf("%s",str1);
}

 (Note: Incase the code Pass for an output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Highly Profitable Months

Desktop Products

Flowchart Logic 047

Find Maxima/Minima

Matrix Print Excluding Border Elements

Reverse Last K Words

Words Starting with Upper Case