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
Cerrena [4.2K]
3 years ago
14

Write a script that calculates the common factors between 8 and 24. To find a common factor, you can use the modulo operator (%)

to check whether a number can be evenly divided into both numbers.
Computers and Technology
1 answer:
AnnyKZ [126]3 years ago
8 0

Answer:

  1. common = []
  2. num1 = 8
  3. num2 = 24
  4. for i in range(1, num1 + 1):
  5.    if(num1 % i == 0 and num2 % i == 0):
  6.        common.append(i)
  7. print(common)

Explanation:

The solution is written in Python 3.

Firstly create a common list to hold a list of the common factor between 8 and 24 (Line 1).

Create two variables num1, and num2 and set 8 and 24 as their values, respectively (Line 3 - 4).

Create a for loop to traverse through the number from 1 to 8 and use modulus operator to check if num1 and num2 are divisible by current i value. If so the remainder of both num1%i and num2%i  will be zero and the if block will run to append the current i value to common list (Line 6-8).

After the loop, print the common list and we shall get [1, 2, 4, 8]

You might be interested in
. the fact that a web app is written to be run within any of the standard
Evgen [1.6K]

The correct answer is C) ease of use.

The fact that a web app is written to be run within any of the standard browser and on any platform on which that browser operates is called "ease of use."

The ease of use concept indicates that the product is "amicable" or "friendly" to use by most people because it is not required andy technical knowledge to operate the product. In this case,  the app is written to be run within any of the standard browser and on any platform on which that browser operates, so it is "friendly" to operate bu most systems. App's companies and software companies created this "ease of use" concept for many of their products so they can sell most of them because people know they are easy to use and functional.

7 0
4 years ago
Explain how for loops can be used to work effectively with elements in an array?
tresset_1 [31]

Explanation:

There are three types of loops in programming languages which are as following:-

  1. for.
  2. while.
  3. do while.

The syntax for all the three loops is different.You will see mostly for loop used with the arrays because they are easy to implement.

the syntax of for loop is :-

for(int i=initial value;condition;i++)

{

body

}

In for loops you only have to write the conditions in only line else is the body of the loop.

for example:-

for array of size 50 printing the each element

for(int i=0;i<50;i++)

{

   cout<<arr[i]<<" ";

}

You have to initialize i with 0 and the condition should be i<size of the array and then increase the counter.

7 0
3 years ago
Consider the following sequence of items 10, 36, 25, 54, 37, 12, 75, 68, 42, 86, 72, 90. Insert these items in the order above,
AnnZ [28]

Answer:

See attachment below

Explanation:

5 0
3 years ago
The ipv6 address fields are 128 bits long, and as such there is no need to extend ip addressing by using either dhcp or nat (i.e
Minchanka [31]

Answer:

True

Explanation:

according to coursehero it's true

6 0
2 years ago
Regarding the Internet of Things (IoT), a business involved in utilities, critical infrastructure, or environmental services can
jeka94

Answer:

A. true

Explanation:

Based on the information provided within the question it can be said that the statement is completely true. This is because, traffic-monitoring applications have the main function of monitoring and analyzing the flow of traffic of one or various different items. Which can be applied to the business involving utility, infrastructure, and environmental services by monitoring the specific items regarding each business. Therefore making sure that enough product is entering or leaving each business as it is suppose to. As well as providing stock analysis and defective product alerts.

6 0
4 years ago
Other questions:
  • Which wildcat character will return a single character when using the find dialog box
    14·1 answer
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    9·2 answers
  • QUESTION 1 _____ is a type of data encryption that enables users of the Internet to securely and privately exchange data through
    14·1 answer
  • It is important to ____ the line in the code editing window in the exact location where you want to insert a code snippet to pro
    10·1 answer
  • The Gauss-Seidel method as an iterative technique often refers to an improved version of the Jacobi method, since the Gauss-Seid
    13·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • Which of the following organizations offers a family of business management system standards that details the steps recommended
    12·1 answer
  • Jim lost his job due to the replacement of robots in a manufacturing factory. As an ethical practice, what should the manufactur
    13·1 answer
  • Try my game? https://scratch.mit.edu/projects/589314237
    13·2 answers
  • Which of the following would be the most appropriate way to define a method that calculates and returns the final price, after t
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!