. can you help me modify my code? the output should be: Enter the word: CodeChum There is a vowel in the word "CodeChum" source code: #include int main() { // declaring the character array char word[100]; // taking user input of the word printf("Enter the word: "); scanf("%s", word); // calling the hasVowel() function and passing the word with it // storing the returned value in a variable result int result = hasVowel(word); // if the result returned is 1 if(result == 1) { printf("There is a vowel in the word \"%s\"", word); } // if the result returned is 0 else if(result == 0) { printf("There is no vowel in the word \"%s\"", word); } return 0; } 2. it says that it is wrong but when I run the program the output is okay, I don't know what's wrong: source code:
1. can you help me modify my code? the output should be:
Enter the word: CodeChum
There is a vowel in the word "CodeChum"
source code:
#include<stdio.h>
int main()
{
// declaring the character array
char word[100];
// taking user input of the word
printf("Enter the word: ");
scanf("%s", word);
// calling the hasVowel() function and passing the word with it
// storing the returned value in a variable result
int result = hasVowel(word);
// if the result returned is 1
if(result == 1)
{
printf("There is a vowel in the word \"%s\"", word);
}
// if the result returned is 0
else if(result == 0)
{
printf("There is no vowel in the word \"%s\"", word);
}
return 0;
}
2. it says that it is wrong but when I run the program the output is okay, I don't know what's wrong:
source code:
!["Only if you can determine if there is a vowel in a certain word"
main.c
1 #include<stdio.h>
2 int nain)
3- {
Shucks! It's always better to be prepared. Who knows that might indeed
happen. I'm going to need your help to create function that'll do this so
// declaring the character array
char word [100];
4
tomorrow, I will just call this function.
6
// taking user input of the word
printf("Enter the word: ");
scanf("%s", word);
7
Instructions:
8
9
1. In the code editor, you are provided a main() function that asks the
10
// calling the hasVowel) function and passing the word with it
// storing the returned value in a variable result
int result = hasVowel(word);
user for a word. This word is then passed to a function called,
11
hasVowel().
12
13
2. Your task is to define the hasVowel() function which has the following
14
details
// if the result returned is 1
if(result == 1)
{
printf("There is a vowel in the word "%s\"", word);
}
15
1. Return type - int
16
2. Name - hasVowel
17 -
3. Parameter:
18
1. char* - to hold the character array
19
20
4. Return value - 1 if there is at least 1 vowel and O if there is none.
// if the result returned is 0
else if(result = 0)
{
printf("There is no vowel in the word \"%s\"", word);
21
Be sure to consider both the capital and small letter vowels when
22
checking.
23 -
24
25
Input
26
27
return 0;
1. The word
28 }
29
<>
CodeChum Terminal
30
Output
main.c: In function 'main' :
main.c:13:18: warning: implicit declaration of function 'hasowel' [-Wimplicit-function-declaration]
13 |
int result = hasVowel (word) ;
Enter the word: Codechum
There is a vowel in the word "Codechum"
...](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb3210701-74b9-4350-a073-c4781ff9425b%2Fe9b9d6fc-972e-4858-9467-d98dff65cc2b%2F5la1ls_processed.png&w=3840&q=75)
![Can you help me find the ring that she wants?
< >
Test Cases
main.c
1 #include <stdio.h>
int findRing (int rings 0, intn, int wantedRing)
3- {int index=0;
2
Instructions:
E Run Tests
for Çint i-0;i<n;i++)
{
if(rings [i]=wantedRing)//Performing a linear search to find the wanted ring
1. In the code editor, you are provided with the main() function that asks
4
5-
the user for 10 elements that represents the options for the ring as well
as a single integer value that represents the ring that she wants. Then,
a call to the findRing() function is made and the array of rings and the
6
Test Case 1
7-
8
index=i;
ring she wants are passed into it.
Your Output
}
}
9
2. Your task is to implement the findRing() function. This has the following
details:
10
return index;
Enter option #1:
Enter option #2:
11
1. Return type - int
2. Name - findRing
12 }
13 - int main) {
Enter option #3:
:
Enter option #4:
3. Parameters
14
int rings [10];
1. int* - for the array of rings
15
Enter option #5:
for Çint i = 0; i <10; i++) {
printf("Enter option #%d: ", i + 1);
scanf("%d", &rings [i]):
}
16 -
2. int - size of the array of rings
Enter option #6:
17
3. int - the ring that she wants
Enter option #7:
18
4. Return value - the index of the ring in the array of rings. It is
guaranteed that there is only one such ring that matches the ring
that she wants.
Enter option #S:
19
20
Enter option #9:
21
Enter option #10:
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
22
Enter the ring sh
23
Input
24
Ring 25 found at
25
printf("\nRing %d found at option %d!", wantedRing, findRing (rings, 10, wantedRing) + 1);
1. Ten integer values representing the rings
26
27
return 0;
2. Integer value representing the ring she wants
28
Expected Output
29 }
Output
Enter option #1:
Enter option #2:
Enter option #3:
Enter option #1: 5
Enter option #4:
Enter option #5:
Enter option #2: 3
Enter option #3: 10
Enter
Enter option #6:
Enter option #4: 9
Enter option #5: 13
Enter option #7:
Enter option #6: 11
Enter option #7: 20
Enter option #8:
Enter option #9:
Enter option #10:](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb3210701-74b9-4350-a073-c4781ff9425b%2Fe9b9d6fc-972e-4858-9467-d98dff65cc2b%2Fx2h2pzo_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)