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
love history [14]
3 years ago
8

Take two String inputs of the same length and merge these by taking one character from each String (starting with the first ente

red) and alternating. If the Strings are not the same length, the program should print "error".
Sample Run 1:

Enter Strings:
balloon
atrophy
baatlrloopohny
Sample Run 2:

Enter Strings:
terrible
mistake
error
Computers and Technology
2 answers:
ArbitrLikvidat [17]3 years ago
6 0

Answer:

Written in Python

print("Enter strings: ")

str1 = input()

str2 = input()

if len(str1) == len(str2):

     for i in range(0,len(str1)):

           print(str1[i]+str2[i], end='')

else:

     print("Error")

Explanation:

Prompts user for two strings

print("Enter strings: ")

The next two lines get the input strings

str1 = input()

str2 = input()

The following if condition checks if length of both strings are the same

if len(str1) == len(str2):

If yes, this iterates through both strings

     for i in range(0,len(str1)):

This prints the the characters of both strings, one character at a time

           print(str1[i]+str2[i], end='')

If their lengths are not equal, the else condition is executed

else:

     print("Error")

Igoryamba3 years ago
4 0

import java.util.Scanner;

public class JavaApplication89 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter Strings:");

       String word1 = scan.nextLine();

       String word2 = scan.nextLine();

       String newWord = "";

       if (word1.length() != word2.length()){

           newWord = "error";

       }

       else{

           for(int i = 0; i < word1.length(); i++){

               newWord += word1.charAt(i)+""+word2.charAt(i);

           }

       }

       System.out.println(newWord);

   }

   

}

This is the java solution. I hope this helps!

You might be interested in
The objective fuction of linear progrmming should be
Minchanka [31]
The real-valued function whose value is to be either minimized or maximized subject to the constraints defined on the given LPP over the set of feasible solutions. The objective function of a LPP is a linear function of the form z = ax + by.
4 0
2 years ago
This is a python program.
denpristay [2]

Answer:

word = input("Type your name: ")

print(len(word))

Explanation:

The len function will count all the chars in the string.

7 0
3 years ago
An alien from planet Tao has descended onto Earth.
DochEvi [55]

An alien from planet Tao has descended onto Earth. The Internet is a massive network of networks, a networking infrastructure. It connects millions of computers together globally, forming a network in which any computer can communicate with any other computer as long as they are both connected to the Internet.

Explanation:

  • A packet is the unit of data that is routed between an origin and a destination on the Internet or any other packet-switched network.
  • Network packets are small amounts of data passed over TCP/IP networks.
  • Latency measures the time it takes between your actions and the response between your computer, the internet, and everything in between.
  • An IP address is a label which is used to identify one or more devices on a computer network. It is comparable to a postal address.
  • The Domain Name System (DNS) is vital to the Internet, providing a mechanism for resolving host names into Internet Protocol addresses. Insecure underlying protocols and lack of authentication and integrity checking of the information within the DNS threaten the proper functionality of the DNS.
  • Transmission Control Protocol is a standard that defines how to establish and maintain a network conversation through which application programs can exchange data. TCP works with the Internet Protocol which defines how computers send packets of data to each other.

3 0
3 years ago
STEAM game launcher question.
son4ous [18]

Answer:

Try to look up csgo map maker and you might be able to transfer the file

Explanation:

4 0
3 years ago
WHAT DOES INFORMATION TECHNOLOGY DO??<br> Do they offer services or products
notsponge [240]
Yes

Explanation: Information technology, or IT, describes any technology that powers or enables the storage, processing and information flow within an organization. Anything involved with computers, software, networks, intranets, Web sites, servers, databases and telecommunications falls under the IT umbrella.
4 0
2 years ago
Other questions:
  • Define inheritance. give an example
    11·1 answer
  • A commonly used font style is _____. superscript periwinkle times new roman point
    7·1 answer
  • There are ways to perform computer commands quickly and multiple times. <br> a. True <br> b. False
    11·2 answers
  • How can you make a circle in JavaScript? Thank you!
    9·1 answer
  • What is one disadvantage of accessing the Internet through a public search engine such as Google or Yahoo?
    10·2 answers
  • Generally considered to be the most important information security policies, what item below defines the actions a user may perf
    11·1 answer
  • What's the difference between cross-site scripting and cross-site request forgery? How do you protect against cross-site request
    15·1 answer
  • How many people are in Siver, on the game Valorant?
    14·1 answer
  • This might sound crazy! But please help.
    10·1 answer
  • Frankie used the ps command to find the process id of an application that he needs to stop. What command-line tool should he use
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!