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
malfutka [58]
3 years ago
9

Complete the firstMiddleLast() function to return a new string with the first, middle, and last character from string. If string

has an even number of characters, grab the middle two characters. It is safe to assume that no string passed in will be less than 3 characters.
Computers and Technology
1 answer:
morpeh [17]3 years ago
4 0

public static void main()

{

String s = Console.ReadLine();

int len = s.length();

Char startletter = s[0];

Char endletter = s[len-1];

string midletter = ‘’;

if(len % 2 ==0)

midletter = s[len/2] + s[(len/2) +1]

else

midletter = s[len/2];

Console.WriteLine(startletter + midletter + endletter);

}

Here the logic is that, startletter is obtained using the index ‘0’, the last letter is obtained by calculating the “length of the string” and subtract 1 to get the “last index” of the given string.

Middle letter is calculated by first finding whether the given string length is “odd or even” and based on that index(es) are identified.

You might be interested in
Mhairi believes that if a site’s information is detailed enough, it is more likely to be true. Is she correct? Answers
inysia [295]
In my opinion, I would say No. So I think the answer is C.
6 0
3 years ago
Read 2 more answers
Using a graphic organizer in the prewriting can do all of the following except what?
ikadub [295]
A. organize the writers thoughts 
<span>B. help narrow the writers topic </span>
<span>C. research a writers story** </span>
<span>D. help make the writing more detailed.</span>
5 0
3 years ago
The Internet and World Wide Web allow almost any business to be global. What are two important results of this process?
lubasha [3.4K]

Answer:

The two Important results of any business to be global is given below.

Explanation:

1.The Internet and World Wide Web allowing the easier and quicker way to getting started any business due to this we can sell the product online and make the business global.

2.The Internet and World Wide Web giving the quicker way to change the business if any changes are reflected in the business environment.

6 0
4 years ago
प्रश्न 19 भारत के संविधान की उद्देशिका में वर्णित किन्ही पॉच मूल्यों का उल्लेख कर अर्थ स्पष्ट करे ?5
iren [92.7K]

Answer:

english please

Explanation:

8 0
3 years ago
What is the difference between asking a question with few points and asking a question with many? New to Brainly :D
ANTONII [103]

Answer:

one would be more helpful and the other more vague and less convincing.

6 0
3 years ago
Other questions:
  • Write a function named print_backward that accepts a String as its parameter and prints the characters in the opposite order. Fo
    12·1 answer
  • Write a program that takes nouns and forms their plurals on the basis of these rules:
    8·1 answer
  • During the Requirements Definition stage of a systems development​ project, the employees who will be the primary users of the n
    15·1 answer
  • Answer: x = 3<br>#1 -2x + 5 = -31​
    10·1 answer
  • Based on your learning this week, consider rules, policies, and procedures. Technicians are often eager to just get started on a
    10·1 answer
  • Which criterion can be used to select the appropriate type of network media for a network?
    8·1 answer
  • In a database, it is possible to make changes such as font, text style, text color, line color, and background color. true false
    13·2 answers
  • /* Write a method called fractionSum that accepts an integer parameter n and
    5·1 answer
  • You learned that you can use the tags to insert a link to another webpage. One problem that webpage developers face is that, aft
    10·1 answer
  • 1. Choose a real or made up company, and describe at least three ways in which the company uses technology. (1-3 sentences. 3.0
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!