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
Naily [24]
3 years ago
13

Write a program that asks the user to input a vector of integers of arbitrary length. Then, using a for-end loop the program exa

mines each element of the vector. If the element is positive, its value is doubled. If the element is negative, its value is tripled. The program displays the vector that was entered and the modified vector. Execute the program, and when the program ask the user to input a vector type randi([−10 20], 1, 19). This creates a 19-element vector with random integers between −10 and 20.
Engineering
1 answer:
ELEN [110]3 years ago
4 0

Answer:

%Program prompts user to input vector

v = input('Enter the input vector: ');

%Program shows the value that user entered

fprintf('The input vector:\n ')

disp(v)

%Loop for checking all array elements

for i = 1 : length(v)

   %check if the element is a positive number

   if v(i) > 0

       %double the element

       v(i) = v(i) * 2;

   %else the element is negative number.

   else

       %triple the element

       v(i) = v(i) * 3;

   end

end

%display the modified vector

fprintf('The modified vector:\n ')

disp(v)

You might be interested in
Birdie Par owns a company that makes golf gloves. She is thinking about introducing a new glove, which would require an addition
melamori03 [73]

Birdie's company will make a profit of $30,000 if she sells 3,000 gloves at the $15 price.

Step-by-step Solution:

Break even point= fixed cost/ selling price - variable cost

here the fixed cost is= $20,000

selling price= $15 and variable cost = $5

BEP= 20,000/ 15-5= 20,000/10= 2000 units

b. if they sell 3000 gloves, the contribution profit will be

total revenue= 3000*$15= $45,000

contribution= selling price- variable cost, 15-5= $10 per unit

the profit is= 3000*$10= $30,000

What is  variable cost?

A variable cost is one that varies in relation to either the volume of production or the number of services provided. There should be no variable costs if no production or services are provided. Variable costs should rise in tandem with increases in production or services.

To learn more about Profit Calculation, visit: brainly.com/question/28177180

#SPJ1

3 0
1 year ago
‼️Will mark brainliest‼️
Slav-nsk [51]
YAll don’t tell my cousin I’m hacking her school resources because I got a 0 in a test and she got a 100

4 0
3 years ago
‏What is the potential energy in joules of a 12 kg ( mass ) at 25 m above a datum plane ?
Virty [35]

Answer:

E = 2940 J

Explanation:

It is given that,

Mass, m = 12 kg

Position at which the object is placed, h = 25 m

We need to find the potential energy of the mass. It is given by the formula as follows :

E = mgh

g is acceleration due to gravity

E=12\times 9.8\times 25\\\\E=2940\ J

So, the potential energy of the mass is 2940 J.

3 0
3 years ago
Please write the following code in Python 3. Also please show all output(s) and share your code.
maksim [4K]

Answer:

sum2 = 0

counter = 0

lst = [65, 78, 21, 33]

while counter < len(lst):

   sum2 = sum2 + lst[counter]

   counter += 1

Explanation:

The counter variable is initialized to control the while loop and access the numbers in <em>lst</em>

While there are numbers in the <em>lst</em>,  loop through <em>lst</em>

Add the numbers in <em>lst</em> to the sum2

Increment <em>counter</em> by 1 after each iteration

6 0
3 years ago
I have a question.What does DIY mean?
alexdok [17]

Answer: It means "Do it yourself".

Explanation: You're welcome!

6 0
2 years ago
Read 2 more answers
Other questions:
  • True or False? Duties of the company officials should be discussed
    11·1 answer
  • In a diesel engine, the fuel is ignited by (a) spark (c) heat resulting from compressing air that is supplied for combustion (d)
    14·1 answer
  • Compute the longitudinal tensile strength of an aligned glass fiber-epoxy matrix composite in which the average fiber diameter a
    9·1 answer
  • Complete the following sentence.
    13·1 answer
  • 1. A turbine in a steam power plant operates isentropically with an inlet pressure (P3) of 3.5 MPa and inlet temperature (T3) of
    9·1 answer
  • If fog is so bad that I can’t see for short distance what should I do
    9·2 answers
  • What are the purpose of studying the strength of materials and testing.
    5·1 answer
  • Technician A says that the low level brake fluid switch on a master cylinder will turn on the brake warning light when the syste
    9·1 answer
  • Does anyone know the answer to this
    5·2 answers
  • Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains: an instanc
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!