You have been hired by an educational software company to create a program that automatically calculates the sum of each place-value of two numbers. You can assume that the user of this program will only enter positive whole numbers greater than zero and less than 10,000.

Respuesta :

Hi, you haven't provided the programing language, therefore, we will use python but you can extend it to any programing language by reading the code and the explanation.

Answer:

n1 = int(input("First numeber: "))

n2 = int(input("Second numeber: "))

for i in range(5):

   r1 = n1%10

   r2 = n2%10

   print(r1+r2)

   n1 = n1//10

   n2 = n2//10

 

Explanation:

  1. First, we ask for the user input n1 and n2
  2. We create a for-loop to calculate the sum of each place-value of two numbers
  3. We obtain the last number in n1 by using the mod operator (%) an the number ten this way we can always take the last value, we make the same for n2
  4. Then we print the result of adding the last two numbers (place value)
  5. Finally, we get rid of the last value and overwrite n1 and n2 to continue with the process
Ver imagen mateolara11
ACCESS MORE