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
Ierofanga [76]
3 years ago
5

Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa

tely from a given string.

Computers and Technology
1 answer:
salantis [7]3 years ago
8 0

Answer:

/ReversedEvenOddString.java

import java.util.Scanner;

public class ReversedEvenOddString {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String s = sc.nextLine();

       String evens = "";

       String odds = "";

       for(int i = s.length()-1;i>=0;i--){

           if(i%2==1){

               odds += s.charAt(i);

           }

           else{

               evens += s.charAt(i);

           }

       }

       String res;

       if(s.length()%2==1){

           res = evens+odds;

       }

       else{

           res = odds+evens;

       }

       System.out.println(res);

   }

}

You might be interested in
?an ip address reservation is made by creating an association between an ip address and what type of client identifier?
victus00 [196]
The ethernet address, a.k.a. mac address. That way, a DHCP server can give the same IP address to a returning client.
3 0
3 years ago
Which of the following do you need to remeber about true/false questions?
lina2011 [118]
All parts of a statement must be true for it to be true
7 0
3 years ago
Write a function which the counts the number of odd numbers and even numbers currently in the stack and prints the results.
Lerok [7]

Answer:

See the code below and the algorithm explanation on the figure.

Explanation:

The explanation in order to get the answer is given on the figure below.

Solving this problem with C. The program is given below:

#include <stdio.h>

int main(void) {

   int n, Even=0, Odd=0, Zeros=0;  

   for (;;) {

       printf("\nEnter the value the value that you want to check(remember just integers): ");

       //IF we input a non-numeric character the code end;

       if (scanf("%d", &n) != 1) break;

       if (n == 0) {

           Zeros++;

       }

       else {

           if (n % 2) {

               Even++;

           }

           else {

               Odd++;

           }

       }

   }  

   printf("for this case we have %d even, %d odd, and %d zero values.", Even, Odd, Zeros);

   return 0;

}

5 0
3 years ago
In 1964 in London, Ontario one could buy a chili-dog and a root beer for $1.25, today the same chili dog and root beer cost $5.0
Marta_Voda [28]

Answer:

3% inflation rise. No correct cpi option

Explanation:

Consumer Price Index(CPI) is calculated by the Bureau of Economic Analysis and Statistics of a country monthly and annually.

Consumer Price Index(CPI) is used for measuring the changes in the price level of consumer goods and services purchased by households.

Calculating the consumer price index; price in 1964= $1.25, today price= $5.0.

Therefore, consumer price index= Price in today- price in 1964÷ price in 1964,.

Consumer Price index(CPI)= $(5-1.25)/1.25 = 3.75/1.25 = 3 Percent price inflation rise.

For the first cpi; 112-80/80= 0.4 percent( not equal to the 3 Percent inflation rise).

For the second cpi: 141.6-60/60= 1.36 Percent inflation rise(not equal to the 3 Percent inflation rise).

For the third CPI: 126.4-75/75 =0.68 percent inflation rise[not equal to the 3 Percent inflation rise].

For the third CPI: 108.5-90/90=0.21 percent inflation rise(not equal to 3 Percent inflation rise)

Therefore, none of the options are right.

5 0
3 years ago
Define quality control​
tangare [24]

Quality control is a system of maintaining standards in manufactured products by testing a sample of the output against the specification.

8 0
3 years ago
Other questions:
  • Typing a ____________ at the beginning of a word will exclude that word when doing a search.
    8·2 answers
  • What type of device is the printer?
    13·2 answers
  • What office application has animations on the home ribbon?
    7·2 answers
  • The theory of continental drift suggests that at one time,
    15·2 answers
  • Two routers, R1 and R2, connect using an Ethernet over MPLS service The service provides point-to-point service between these tw
    11·1 answer
  • 25 Points Discuss games you have played that have poor game design puzzles and how you might improve them.
    10·1 answer
  • Write a script that will read the file, (strip the carriage returns), create a dictionary of names and favorite radishes and cre
    9·1 answer
  • Define the terms of data and information .​
    6·1 answer
  • Write a program that outputs "Hello World!".
    8·1 answer
  • Difference between centralized and decentralized processing in computer
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!