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
How was science used to make television?
Wewaii [24]

Answer:

Sir William Crookes invented the cathode ray tube in 1878, but these discoveries took many years to merge into the common ground of television. His mechanical system used a scanning disk with small holes to pick up image fragments and imprint them on a light-sensitive selenium tube. A receiver reassembled the picture.

5 0
3 years ago
Read 2 more answers
The field of ____ is concerned with the technical issues involved in information display. computer science
Nataliya [291]

The field of <u>Computer graphics</u> is concerned with the technical issues involved in the information display. The correct option is A.

<h3>What is computer graphics?</h3>

Computer graphics is a branch of computer science called computer graphics research techniques for digitally synthesizing and modifying visual content.

Even while the phrase is frequently used to describe the study of three-dimensional computer graphics, it also includes image processing and two-dimensional graphics. This section works for information display.

Thus, the correct option is A. Computer graphics.

To learn more about computer graphics, refer to the link:

brainly.com/question/1169945

#SPJ4

The question is incomplete. Your most probably complete question is given below:

Computer graphics

computer-aided visualization

computer visualization

engineering graphics

7 0
2 years ago
What is the memory of the five generations of computers?​
uysha [10]

Answer: Magnetic drum

Explanation: First generation computers used magnetic drum for memory

5 0
3 years ago
Read 2 more answers
rite a function, reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed. For example
arlik [135]

following are the code in c language

#include<stdio.h> // header file  

int reverseDigit(int n);  // prototype of  reverseDigit function

int main()  // main method

{

int n;  // variable declaration

printf("Enter a number to reverse\n");

scanf("%d", &n);  // input value by user

int t=reverseDigit(n);  // calling  reverseDigit function

printf("the value of reverseDigit(%d)",n);  

printf(" is %d",t); // display reverse digit

 return 0;

}

int reverseDigit(int n)   // function definition of reverseDigit function

{

   int r=0;

    while(n!=0)  // iterating over the loop

  {

     r = r* 10;

     r= r+ n%10;

     n= n/10;

  }

  return(r);  // return the reverse digit

  }

Explanation:

In this we call a function  reverseDigit, from the main function after calling control moves to the definition of  reverseDigit, function ,the while loop is iterating .In the while loop, we find the remainder r when number is divided  by 10 then it will multiplied by 10 and add previous remainder after that number will be updated as n/10 . Then function will return number r and print them in main function.

output

Enter a number to reverse

12345

the value of reverseDigit(12345) is 54321

3 0
4 years ago
Does Logarithms and Algorithms same things?
Roman55 [17]

Answer: No, logarithms and algorithms are not the same things.

Explanation:

Logarithms:- It is usually mention term in the mathematical field. It is mentioned as the  function used for determination of exponent of base where the base is equal to some known number.

Algorithms:- It is a procedure which is used for solving any certain type of problem using tools like flowchart, programming languages etc. It is usually a term that is mentioned in computer science or mathematics to solve a problem in steps , instruction or other ways.

6 0
4 years ago
Other questions:
  • Assign a pointer to any instance of searchChar in personName to searchResult.#include #include using namespace std;int main() {c
    5·1 answer
  • A software program that allows a programmer to type in code. modern versions usually make it easy to format the code on the scre
    13·1 answer
  • Analysts use _____ to show the objects that participate in a use case and the messages that pass between the objects over time f
    12·1 answer
  • How do you autofit a column to fit the longest word in Microsoft Word?
    5·2 answers
  • 2. What is data redundancy?
    14·1 answer
  • How is “compromise" defined in the context of information technology and Select one answer.
    5·2 answers
  • Part 1: 1) Write a C program getPhoneNumber.c that accepts a phone number from the user in the form XXX-XXX-XXXX, and then displ
    12·1 answer
  • What are some specific ways that businesses use the internet?
    6·2 answers
  • This type of headline sits next to a story.<br> Banner<br> Slammer<br> Hammer<br> Sidesaddle
    8·2 answers
  • What is the system of computers, routers, wires, cables,etc. that allow computers to communicate called?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!