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
Xelga [282]
3 years ago
14

Write the code in python to ask the user to input two integers. Your program will then print the greatest common divisor of the

two integers. Look at the math module for a function that will help you find the greatest common divisor.
Computers and Technology
1 answer:
Hunter-Best [27]3 years ago
3 0

import math

num1 = int(input("Enter a number: "))

num2 = int(input("Enter a number: "))

print(math.gcd(num1, num2))

The gcd() - greatest common divisor function, which is part of the math module works perfectly in this situation.

You might be interested in
Write a method named countMatching(). It has two parameters: a String and a character. The method returns a count of how many ti
andreev551 [17]

Answer:

Check the explanation

Explanation:

public static int countMatching(String s, char c) {

   int count = 0;

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

       if (s.charAt(i) == c)

           ++count;

   }

   return count;

}

Method in a complete Java program

public class FizzBuzz {

/* sample run:

    * z appears 2 time(s) in FIZZbuzz

    */

   public static void main(String[] args) {

       String s = "FIZZbuzz";

       char c = 'z';

       int count = countMatching(s, c);

       System.out.printf("%c appears %d time(s) in %s%n", c, count, s);

   }

   // Put your countMatching() method here:

   public static int countMatching(String s, char c) {

       int count = 0;

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

           if (s.charAt(i) == c)

               ++count;

       }

       return count;

   }

}

z appears 2 time(s) in FIZZbuzz Process finished with exit code

4 0
4 years ago
Draw a full binary tree of height 2. How many nodes does it have?
Paraphin [41]

Answer:

The number of nodes in a full binary tree of height 2 = 7

Explanation:

At each level k, of the full binary tree there are usually 2^{k} \\ nodes.

So the full binary tree of height 2 has nodes= 2^{0} \\ + 2^{1} \\ + 2^{2} \\.

which is 7.

6 0
4 years ago
4.
marshall27 [118]

Answer: c

Explanation:

5 0
3 years ago
In Asch’s study which of these lowered conformity rates
skad [1K]

Answer:

D. all of these are correct

Explanation:

option d is correct answer

3 0
3 years ago
Read 2 more answers
What materials can I find at home and make a cell phone tower​
MAVERICK [17]

Answer:

you cant

Explanation:

You simply cant make a tower from materials found in a household

4 0
3 years ago
Other questions:
  • Laura is using studio lighting while photographing a model. The four elements that she will use in studio lighting are hot light
    10·1 answer
  • The following parts were ordered by someone building a personal computer:
    12·1 answer
  • What is the accounting equation?
    12·1 answer
  • Briefly describe the interface between the memory and the processing unit. That is, describe the method by which the memory and
    6·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • Horizontal lines should be avoided in photographs because they make the photograph appear small.
    8·1 answer
  • Which of these statements best compares P waves and S waves of an earthquake?
    5·1 answer
  • Large computer programs, such as operating systems, achieve zero defects prior to release. Group of answer choices True False Pr
    7·1 answer
  • Prove that: P = hdg​
    7·2 answers
  • What is the main coding language for netflix?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!