Question: Exercise 6 : Extracting the Middle ( Reference: Textbook Chapter 3 Worked Example 3 . 1 ) ( for coamination of the problem. save Companice

Exercise 6: Extracting the Middle (Reference: Textbook Chapter 3 Worked Example 3.1)
(for coamination of the problem. save Companice Site)
Your task is to extract a string comtaining the middle character from a given string ser For example, if the string is "crate", the result is the string "a". However, if the string has an even number of letters, extract the midlle rwo charactes If the string is "crases", the result is "at"
Step 1 Decide on the branching condition
We aced to tuke different actions for strings of codd and cuen length.
Derefore, the condizion is 1s the lingth of the srring odd?
In lava, you use the remainder of division by 2 in find out utether a value is even of odd Then ife lest becomes strjengthi %2-1?
 Exercise 6: Extracting the Middle (Reference: Textbook Chapter 3 Worked Example

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!