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
GarryVolchara [31]
2 years ago
13

Assume you want to write a code to calculate the addition of two numbers digit by digit. Provide the running time for your algor

ithm, assuming the inputs are two n-digit numbers. Explain your answer
Computers and Technology
1 answer:
Sergio039 [100]2 years ago
5 0

Answer:

Explanation:

Using Python programming language

Explanation:

1. I defined a function add and passed in two parameters (a,b).

2. In the block of the function, I added the two numbers and printed the result.

3. I decided to use a function so that the program is re-usable and can accept various inputs.

Find the code below. (# are used for comments)

#Addition of numbers

def add(a,b):

   print(a+b)

#Test Cases

add(2,4.5)      #Result=6.5

add(10,290)     #Result=300

add(2.567,4.58) #Result=7.147

You might be interested in
Suppose we have two String objects and treat the characters in each string from beginning to end in the following way: With one
Simora [160]

Answer:

If all the character pairs match after processing both strings, one string in stack and the other in queue, then this means one string is the reverse of the other.                            

Explanation:

Lets take an example of two strings abc and cba which are reverse of each  other.

string1 = abc

string2 = cba

Now push the characters of string1 in stack. Stack is a LIFO (last in first out) data structure which means the character pushed in the last in stack is popped first.

Push abc each character on a stack in the following order.

c

b

a

Now add each character of string2 in queue. Queue is a FIFO (first in first out) data structure which means the character inserted first is removed first.

Insert cba each character on a stack in the following order.

a   b   c

First c is added to queue then b and then a.

Now lets pop one character from the stack and remove one character from queue and compare each pair of characters of both the strings to each other.

First from stack c is popped as per LIFO and c is removed from queue as per FIFO. Then these two characters are compared. They both match

c=c. Next b is popped from stack and b is removed from queue and these characters match too. At the end a is popped from the stack and a is removed from queue and they both are compared. They too match which shows that string1 and string2 which are reverse of each other are matched.

6 0
3 years ago
Please help. 10 points
pickupchik [31]

Answer:

God Is Good He Will Always Help You He Is Good And Always Good!!

If God Is For Us Who Can Be Against us?? Romans 8:31

Explanation:

6 0
2 years ago
Read 2 more answers
How do you change the desktop background in the macos mojave operating system?
sleet_krkn [62]

Answer: Click the System Preferences icon on the dock. In the first row, click Desktop & Screen Saver.

Explanation: When it comes to macOS versions, Mojave and High Sierra are very comparable. The two have a lot in common, unlike Mojave and the more recent Catalina.

8 0
1 year ago
OSHA standards appear in the ___________ and are then broken down into ____________.
miskamm [114]
OSHA standards appear in the <span>Code of Federal Regulations (CFR) and are then broken down into Parts</span>
3 0
2 years ago
After which problem-solving stage should you take action?
Mumz [18]

Answer:

Option: Making a choice

Explanation:

In a problem solving process, it starts with defining a problem which is the first step that we need to identify the issue.

After that, we should gather the information on the issue that we identify. For example, we are root cause of the problem, what are the possible solutions etc.

Next, we evaluate the information that we collect (e.g. pro and cons of a particular solution).

Next, we make a choice on the solution that we are going to take after further evaluation on all the options we have.

Only after we make a choice, then we can take action based on our chosen solution to solve the problem.

4 0
3 years ago
Other questions:
  • Categories of general purpose application software and examples each​
    13·1 answer
  • The name of the opening that lets light into any camera is called ________.
    11·2 answers
  • How can I sent a message?
    13·1 answer
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • The negotiation by the transport layer at the sender with the transport layer at the receiver to determine what size packets sho
    14·1 answer
  • Social media is a type of ___________ ccommunication (type either push or pull for your response).
    8·2 answers
  • Which type of computer graphic can be blown up to a much larger size without getting distorted or losing quality?
    5·1 answer
  • What device provides ports to allow a laptop to easily connect to a full-sized monitor, keyboard, ac power adapter, and other pe
    11·1 answer
  • Where or what website can I download anime's? For free ​
    6·1 answer
  • What's the difference between joystick and mouse​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!