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
luda_lava [24]
3 years ago
15

You have been hired by an educational software company to create a program that automatically calculates the sum of each place-v

alue 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.

Computers and Technology
1 answer:
Vinvika [58]3 years ago
4 0

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

You might be interested in
Question 2 of 10
NeTakaya

Answer:

D.

Because you said it was.

3 0
2 years ago
First write a method to calculate the greatest common divisor (GCD) of two positive integers using Euclid’s algorithm (also know
MAVERICK [17]

Answer:

import java.util.Scanner;

public class Gcd

{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Enter two numbers to find their GCD: ");

 int number1 = input.nextInt();

 int number2 = input.nextInt();

 

 if(number1 > 0 && number2 > 0)

     System.out.println("GCD of " + number1 +" and " + number2 +" is: " + findGCD(number1, number2));

       else

           System.out.println("Invalid Input!");

}  

public static int findGCD(int number1, int number2) {

    if(number2 == 0){

        return number1;

    }

return findGCD(number2, number1 % number2);

}

}

Explanation:

To be able to find GCD, we need to factorize the numbers and multiply common factors.

- <u>Inside the function:</u>

- Recursively divide <em>number1</em> by <em>number2</em> until <em>number2</em> is equal to zero.

- Return <em>number1</em>  when the <em>number2</em> is equal to zero. That means we found all the divisors of <em>number1</em>

- <u>Inside the main:</u>

- Ask user to input numbers

- Check if both numbers are greater than zero

- If they satisfy the condition, call the method and print the result.

7 0
3 years ago
As a member of the accounting group,
Anastasy [175]

Answer:

rtg

Explanation:

rth

3 0
3 years ago
In GIMP, the ( ) displays the image that the user is currently working on
kotykmax [81]
I don'r know what your trying to use? GIMP is a free photo editing software just upload it to photobucket.
7 0
3 years ago
What are the uses of computer in educational setting?
Arada [10]

Answer:

Quick Communication & Correspondence

Explanation:

Another main advantage of using computers in the education field is the improvement in the quality of teaching-learning process and communication between students & teachers. For this, they use Microsoft PowerPoint to prepare electronic presentations about their lectures.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Write a Python program that will take as input 5 integer values and will output the average of the odd values and the average of
    6·1 answer
  • In report design view, you can use commands on the align button of the _____ tab.​
    11·1 answer
  • why is wrong timing, poor technology, bad implementation and politics in business affected the OSI model as a standard
    5·1 answer
  • Markup is best defined as
    11·1 answer
  • How to change screen resolution in windows 10?
    5·1 answer
  • 1- Which of the following is the java keyword used to declare a class?
    5·2 answers
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • What is the output of the code snippet given below?string s = "abcde";int i = 1;while (i &lt; 5){ cout &lt;&lt; s.substr (i, 1);
    11·1 answer
  • Random Access Memory is tempory computer memory that stores works in progress
    7·1 answer
  • Which camera is interchangeable<br><br> freeform<br><br> hybrid<br><br> DSLR<br><br> point and shoot
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!