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
Select all the sets that are countably infinite. Question 3 options: the set of real numbers between 0.1 and 0.2 the set of all
timama [110]

Answer:

1.  the set of real numbers between 0.1 and 0.2

2. the set of all negative integers greater than negative 1 trillion

3.  the set of all java and C programs

Explanation:

A set is countable if it is either finite or has the same cardinality as the set of positive integers. The inverse of this set type is uncountable.

The set of real numbers between 0.1 and 0.2, all negative integers greater than negative 1 billion, and a set of java and C programs are all countable sets, so are considered countably infinite.

5 0
2 years ago
Physical activity such as sports or even a brisk walk can help reduce
ycow [4]
Physical activity could help reduce the chance ofheart disease
4 0
2 years ago
Read 2 more answers
Explain how communication has helped to the staff in organization to reach their maximum delivery of service with efficience and
Gwar [14]

Answer:

i don't know

Explanation:

6 0
2 years ago
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alre
Fudgin [204]

Answer:

The c++ program to implement the while loop is given below.

#include <iostream>

using namespace std;

int main() {

  // declaration of integer variables

   int k, n, total;

   // initialization of integer variables

   k=1, n=4, total=0;

//  loop executed till value of k becomes equal to value of n

   while( k <= n ){

       // cube of every integer is added to the variable total

       total = total + ( k * k * k );

       // value of k is incremented to go to the next number

k = k + 1 ;

   }  

   return 0;

}  

Explanation:

The program begins with the declaration of integer variables.  

int k, n, total;

This is followed by initialization of these variables.

k=1, n=4, total=0;

The while loop runs over the variable k which is initialized to 1. The loop runs till value of k reaches the value of integer n.

First, cube of k is computed and added to the variable total.

After first execution of the loop, total is initialized to the cube of 1.

Next, value of variable k is incremented by 1 so that k is initialized to next integer.

After first execution of the loop, k is incremented from 1 to 2.

while( k <= n )

{

total = total + ( k * k * k );

k = k + 1 ;

   }

When the value of k reaches the value of integer n, the cube of n is calculated and added to the variable, total.

When k is incremented, it becomes more than n and hence, loop gets terminated.

As the return type of main is int, the program terminates with the statement shown below.

return 0;

No output is displayed as it is not mentioned in the question.

No user input is taken as it is mentioned that integer variables are already initialized.

4 0
3 years ago
Kelley is managing a project to deploy the company's new application offering by using a cloud service provider for the platform
Lapatulllka [165]

Answer:

Analyse performance

Explanation:

During the deployment of new services to a certain Platform such as the cloud which is geared towards enhancing scalability which is the ability of platforms to accommodate larger load level are serve an increased number of consumers. These will require these platforms to be Analysed as per performance in other to evaluate them . Through performance analysis, elasticity may need to be tweaked by dynamic rearrangement of the different modules, hardwares in other to ensure that the platform delivers at the required level to serve the increased number of consumers.

3 0
2 years ago
Other questions:
  • In a program called Nature's Notebook, citizen volunteers make and report observations about seasonal changes in plants and anim
    15·1 answer
  • Which of the preventive strategies is described below: Violence often escalates. Behaviors like excessive complaing, hostility,
    10·1 answer
  • A user reports his or her computer is slow to boot. You check the boot order and determine that the computer is checking the C d
    12·1 answer
  • How much a 1 Gigabyte in Bytes:<br> 1. 1e+9<br> 2. 1e+6<br> 3. 1000
    8·2 answers
  • Micheal has increased the contrast of the given picture. Which feature or menu option of a word processing program did he use? A
    15·1 answer
  • Lol who look at this so funny
    6·1 answer
  • When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignore
    5·1 answer
  • Which term is defined as an exploit that takes place before the security community or software developer knows about the vulnera
    12·1 answer
  • Savings accounts usually offer _________ interest rates than checking accounts. It is _________ to access your money in a saving
    10·2 answers
  • WHATS YALL FAVORITE GAME WHOEVER GIVES THE BEST ANSWER WINS 200
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!