1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lisov135 [29]
2 years ago
10

Write a function called middle(string str) that returns a string containing the middle character in str if the length of str is

odd, or the two middle characters if the length is even. Write the main that tests this function.
Computers and Technology
1 answer:
jenyasd209 [6]2 years ago
3 0

Answer:

Note: a) If the length of the string is odd there will be two middle characters.

Explanation:

b) If the length of the string is even there will be one middle character. There was a problem connecting to the server. Please check your connection and try running the trinket again.

You might be interested in
NOTE: in mathematics, division by zero is undefined. So, in C , division by zero is always an error. Given a int variable named
Sergio [31]

Answer:

#include <stdio.h>

int main()

{

   int callsReceived, operatorsOnCall;

   scanf("%d", &callsReceived);

   scanf("%d", &operatorsOnCall);

if(callsReceived>=0 && operatorsOnCall>0)

{

   printf("%d",callsReceived/operatorsOnCall);

}

else

{

   printf("INVALID") ;

} }

Explanation:

The programming language to use here is C.

There is an int type variable named callsReceived    

Another int type variable is operatorsOnCall

scanf is used to read values into callsReceived and operatorsOnCall

printf is used to print the number of calls received per operator which is found by dividing the calls received with the operators on call i.e. callsReceived / operatorsOnCall

Here the callsReceived is the numerator and should be greater than or equal 0 and operatorsOnCall is the denominator and should be less than 0. So an IF condition is used to check if the value stored in operatorsOnCall is greater than 0 and if the value stored in callsReceived is greater than or equal to 0 in order to precede with the division. AND (&&) logical operator is used to confirm that both these conditions should  hold for the IF statement to evaluate to TRUE.

In case the input is not valid, the else part is displayed which means that the message INVALID will be displayed.

In C++ cin is used to read from callsReceived and operatorsOnCall and cout is used to display the results of division or the INVALID message in case the IF condition is false. Rest of the code is the same.

cin >> callsReceived;

cin >> operationsOnCall;

if(callsReceived>=0 && operatorsOnCall>0)

   cout << (callsReceived/operationsOnCall);

else

   cout << "INVALID";

8 0
3 years ago
One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.
dsp73

The lamp and the ice bag were at the same place.  
Sounds like the experiment was intended to show on a small scale ocean currents from the poles to the equator and back to the poles. The bag of ice would simulate the cold at the poles while the lamp would simulate the heat provided by the sun near the equator. With that in mind, let's look at the possible flaws and see what is likely.  
Not enough ink was added.
 * If you can see the ink, then there's enough ink. So this isn't the correct choice.  
Not enough water was taken.
 * Possibility there wasn't enough volume of water to setup a current, but not too likely since the baking dish was filled. So let's look further. 
 The dish was too small for the experiment.
 * Same as above. It might be this, but there's something more likely. 
 The lamp and the ice bag were at the same place.
 * This sounds like a winner. In the real world, the poles are cold and the equator gets more sunlight. So there's a temperature gradient. In the described setup, both the heat sink (the bag of ice) and the heat source (the lamp) were at the same location.
5 0
3 years ago
In cell N2, enter a formula using the IF function and structured references as follows to determine which work tier Kay Colbert
sattari [20]

The IF Function based formula that can be entered into cell N2 that will return 2 if true, and 1 if false is =IF(M2 >=4, 2, 1).

<h3>How is the IF function used?</h3>

An IF function allows us to be able to sort through data by analyzing data to find out if it conforms to a certain characteristic that we are looking for.

If the data corresponds, the IF function will return a value that means True, but if it doesn't, the value returned would be false.

After typing in the IF function, the next thing to do is specify the cell where the data you want to analyze is. In this case that data is in cell M2. You immediately follow this up by the parameter being compared.

In this case, we want to know if the figure in cell M2 is greater or equal to 4 so the next entry is M2>=

The next entry is the return if the comparison is true. In this case, the number for true is 2 and the one for false is 1. The full formula becomes:

=IF(M2 >=4, 2, 1).

In conclusion, the function is =IF(M2 >=4, 2, 1).

Find out more on the spreadsheets at brainly.com/question/1429504.

#SPJ1

8 0
2 years ago
A signal has a wavelength of 1 11m in air. How far can the front of the wave travel during 1000 periods?
olchik [2.2K]

Answer:

A signal has a wavelength of 1 μm in air

Explanation:

looked it up

6 0
3 years ago
What is computing networking​
andre [41]
A computer network is a group of computers that use a set of common communication protocols over digital interconnections for the purpose of sharing resources located on or provided by the network nodes.
6 0
3 years ago
Other questions:
  • What are some consequences of internet addiction​
    9·1 answer
  • Which of the following sentences uses the correct verb tense?
    8·2 answers
  • Rate is how fast a screen updates the information being displayed.
    6·2 answers
  • Write a Python program to do the following: (a)Use a for loop and a random integer generator to generate 5 random integers in 1
    10·1 answer
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    9·1 answer
  • It is an attribute that must be used in the form tag in specifying an input file type
    9·1 answer
  • Why is it important to brain storm and develop concepts prior to selecting an idea that you wish to move forward with as a solut
    7·1 answer
  • Which is not a factor that leads to technological advancement?
    8·1 answer
  • Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for th
    13·1 answer
  • <br> Help me please I need the correct answe
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!