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
Genrish500 [490]
3 years ago
15

Write a function to find the factors of an input number. The function should have one input n and a single output of a vector wh

ose entries are the factors of n. The only built in functions you are allowed to use are mod or rem (I would prefer mod). Demonstrate that your function works as expected.
Engineering
1 answer:
Hoochie [10]3 years ago
6 0

The following is the program.                                                          

<u>Explanation</u>:

  • We should  find the factors of input number
  • We can use  python to find the factors of input number
  • In this program, we can use the mod function.

def print_factors(y):

   print("The factors of",y,"are:")

     for j in range(1, y + 1):

          if y % j == 0:

                print(j)

num = 320

print_factors(num)

The above program calculates the factors of n. Here def is called as define function. We are calculating the factors of y. After that, we are giving them for the condition. If the condition is true it will print the factors of y.

                                   

You might be interested in
A video inspection snake is use
LekaFEV [45]

Answer:

very good thx

Explanation:

5 0
2 years ago
WHAT IS THIS PLSSSSSS HELP
alekssr [168]

Answer:

It looks like... A machine that reads electric pulse and surge... Not sure though.

Explanation:

8 0
2 years ago
What is the best way to submit your assignments?
Mrac [35]
A. Email your teacher right away. It would be the safest option.
4 0
2 years ago
Read 2 more answers
g For this project you are required to perform Matrix operations (Addition, Subtraction and Multiplication). For each of the ope
Kruka [31]

Answer:

C++ code is explained below

Explanation:

#include<iostream>

using namespace std;

//Function Declarations

void add();

void sub();

void mul();

//Main Code Displays Menu And Take User Input

int main()

{

  int choice;

  cout << "\nMenu";

  cout << "\nChoice 1:addition";

  cout << "\nChoice 2:subtraction";

  cout << "\nChoice 3:multiplication";

  cout << "\nChoice 0:exit";

 

  cout << "\n\nEnter your choice: ";

 

  cin >> choice;

 

  cout << "\n";

 

  switch(choice)

  {

      case 1: add();

              break;

             

      case 2: sub();

              break;

             

      case 3: mul();

              break;

     

      case 0: cout << "Exited";

              exit(1);

     

      default: cout << "Invalid";      

  }

  main();  

}

//Addition Of Matrix

void add()

{

  int rows1,cols1,i,j,rows2,cols2;

 

  cout << "\nmatrix1 # of rows: ";

  cin >> rows1;

 

  cout << "\nmatrix1 # of columns: ";

  cin >> cols1;

 

   int m1[rows1][cols1];

 

  //Taking First Matrix

  for(i=0;i<rows1;i++)

      for(j=0;j<cols1;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m1[i][j];

          cout << "\n";

      }

  //Printing 1st Matrix

  for(i=0;i<rows1;i++)

  {

      for(j=0;j<cols1;j++)

          cout << m1[i][j] << " ";

      cout << "\n";

  }

     

  cout << "\nmatrix2 # of rows: ";

  cin >> rows2;

 

  cout << "\nmatrix2 # of columns: ";

  cin >> cols2;

 

  int m2[rows2][cols2];

  //Taking Second Matrix

  for(i=0;i<rows2;i++)

      for(j=0;j<cols2;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m2[i][j];

          cout << "\n";

      }

  //Displaying second Matrix

  cout << "\n";

  for(i=0;i<rows2;i++)

  {

      for(j=0;j<cols2;j++)

          cout << m2[i][j] << " ";

      cout << "\n";

  }

  //Displaying Sum of m1 & m2

  if(rows1 == rows2 && cols1 == cols2)

  {

      cout << "\n";

      for(i=0;i<rows1;i++)

      {

          for(j=0;j<cols1;j++)

              cout << m1[i][j]+m2[i][j] << " ";

          cout << "\n";  

      }

  }

  else

      cout << "operation is not supported";

     

  main();

 

}

void sub()

{

  int rows1,cols1,i,j,k,rows2,cols2;

  cout << "\nmatrix1 # of rows: ";

  cin >> rows1;

 

  cout << "\nmatrix1 # of columns: ";

  cin >> cols1;

 

   int m1[rows1][cols1];

 

  for(i=0;i<rows1;i++)

      for(j=0;j<cols1;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m1[i][j];

          cout << "\n";

      }

 

  for(i=0;i<rows1;i++)

  {

      for(j=0;j<cols1;j++)

          cout << m1[i][j] << " ";

      cout << "\n";

  }

     

  cout << "\nmatrix2 # of rows: ";

  cin >> rows2;

 

  cout << "\nmatrix2 # of columns: ";

  cin >> cols2;

 

  int m2[rows2][cols2];

 

  for(i=0;i<rows2;i++)

      for(j=0;j<cols2;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m2[i][j];

          cout << "\n";

      }

 

  for(i=0;i<rows2;i++)

  {

      for(j=0;j<cols2;j++)

          cout << m1[i][j] << " ";

      cout << "\n";

  }

  cout << "\n";

  //Displaying Subtraction of m1 & m2

  if(rows1 == rows2 && cols1 == cols2)

  {

      for(i=0;i<rows1;i++)

      {

          for(j=0;j<cols1;j++)

              cout << m1[i][j]-m2[i][j] << " ";

          cout << "\n";  

      }

  }

  else

      cout << "operation is not supported";

     

  main();

 

}

void mul()

{

  int rows1,cols1,i,j,k,rows2,cols2,mul[10][10];

  cout << "\nmatrix1 # of rows: ";

  cin >> rows1;

 

  cout << "\nmatrix1 # of columns: ";

  cin >> cols1;

 

   int m1[rows1][cols1];

 

  for(i=0;i<rows1;i++)

      for(j=0;j<cols1;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m1[i][j];

          cout << "\n";

      }

  cout << "\n";

  for(i=0;i<rows1;i++)

  {

      for(j=0;j<cols1;j++)

          cout << m1[i][j] << " ";

      cout << "\n";

  }

     

  cout << "\nmatrix2 # of rows: ";

  cin >> rows2;

 

  cout << "\nmatrix2 # of columns: ";

  cin >> cols2;

 

  int m2[rows2][cols2];

 

  for(i=0;i<rows2;i++)

      for(j=0;j<cols2;j++)

      {

          cout << "\nEnter element (" << i << "," << j << "): ";

          cin >> m2[i][j];

          cout << "\n";

      }

  cout << "\n";

  //Displaying Matrix 2

  for(i=0;i<rows2;i++)

  {

      for(j=0;j<cols2;j++)

          cout << m2[i][j] << " ";

      cout << "\n";

  }

     

  if(cols1!=rows2)

      cout << "operation is not supported";

  else

  {

      //Initializing results as 0

      for(i = 0; i < rows1; ++i)

  for(j = 0; j < cols2; ++j)

  mul[i][j]=0;

// Multiplying matrix m1 and m2 and storing in array mul.

  for(i = 0; i < rows1; i++)

  for(j = 0; j < cols2; j++)

  for(k = 0; k < cols1; k++)

  mul[i][j] += m1[i][k] * m2[k][j];

// Displaying the result.

  cout << "\n";

  for(i = 0; i < rows1; ++i)

      for(j = 0; j < cols2; ++j)

      {

      cout << " " << mul[i][j];

      if(j == cols2-1)

      cout << endl;

      }

      }  

  main();

 }

5 0
2 years ago
A pipeline (NPS = 14 in; schedule = 80) has a length of 200 m. Water (15℃) is flowing at 0.16 m3/s. What is the pipe head loss f
dangina [55]

Answer:

Head loss is 1.64

Explanation:

Given data:

Length (L) = 200 m

Discharge (Q) = 0.16 m3/s

According to table of nominal pipe size , for schedule 80 , NPS 14,  pipe has diameter (D)= 12.5 in or 31.8 cm 0.318 m

We know, head\ loss  = \frac{f L V^2}{( 2 g D)}

where, f = Darcy friction factor

V = flow velocity

g = acceleration due to gravity

We know, flow rate Q = A x V

solving for V

V = \frac{Q}{A}

    = \frac{0.16}{\frac{\pi}{4} (0.318)^2} = 2.015 m/s

obtained Darcy friction factor  

calculate Reynold number (Re) ,

Re = \frac{\rho V D}{\mu}

where,\rho = density of water

\mu = Dynamic viscosity of water at 15 degree  C = 0.001 Ns/m2

so reynold number is

Re = \frac{1000\times 2.015\times 0.318}{0.001}

            = 6.4 x 10^5

For Schedule 80 PVC pipes , roughness (e) is  0.0015 mm

Relative roughness (e/D) = 0.0015 / 318 = 0.00005

from Moody diagram, for Re = 640000 and e/D = 0.00005 , Darcy friction factor , f = 0.0126

Therefore head loss is

HL = \frac{0.0126 (200)(2.015)^2}{( 2 \times 9.81 \times 0.318)}

HL = 1.64 m

7 0
3 years ago
Other questions:
  • A simply supported beam spans 25 ft and carries a uniformly distributed dead load of 0.6 kip/ft, including the beam self-weight,
    15·1 answer
  • What is a build enviroment in construction
    8·1 answer
  • A parallel plate capacitor has a separation of 2x10 m and free space between the plates. A 10 V battery is connected across the
    9·1 answer
  • How does refrigeration preserve food and dead bodies​
    12·2 answers
  • 4. Two technicians are discussing the evaporative emission monitor. Technician A says that serious monitor faults cause a blinki
    14·1 answer
  • A spring (70 N/m ) has an equilibrium length of 1.00 m. The spring is compressed to a length of 0.50 m and a mass of 2.2 kg is p
    14·2 answers
  • Ammonia in a piston–cylinder assembly undergoes two processes in series. At the initial state, p1 = 120 lbf/in.2 and the quality
    15·1 answer
  • Who else hates this because i do
    12·2 answers
  • The pressure less than atmospheric pressure is known as:
    6·1 answer
  • How buy airpods in my phone​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!