What should the parameter inside the recursive function in LINE 11 contain so that when user enters an odd number in the main program, the output should be the next [larger] even number; but when the input is an even number, the result is still the same number?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question
100%

I need help in this C Program Recursion Question in the Screenshot

 

What should the parameter inside the recursive function in LINE 11 contain so that when user enters an odd number in the main program, the output should be the next [larger] even
number; but when the input is an even number, the result is still the same number?
1 #include<stdio.h>
2
3 int mwimwa (int i)
4 {
9
10
11
12 }
19
20
}
Oi-2
Oi
if (i % 2) {
13
14 int main()
15 {
16
17
18
}
Oi-1
else
i=i+1;
return i;
return mwimwa
O None of the Choices
int mwimwa (int i)
int num;
scanf("%d", &num);
printf("%d", mwimwa (num));
return 0;
Transcribed Image Text:What should the parameter inside the recursive function in LINE 11 contain so that when user enters an odd number in the main program, the output should be the next [larger] even number; but when the input is an even number, the result is still the same number? 1 #include<stdio.h> 2 3 int mwimwa (int i) 4 { 9 10 11 12 } 19 20 } Oi-2 Oi if (i % 2) { 13 14 int main() 15 { 16 17 18 } Oi-1 else i=i+1; return i; return mwimwa O None of the Choices int mwimwa (int i) int num; scanf("%d", &num); printf("%d", mwimwa (num)); return 0;
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr