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
ss7ja [257]
4 years ago
11

Write a MATLAB program using afor loopto determine the number of values thatarepositive, the number of values that are negative,

and the number of values that equal zero ina vector containing N elements. Prompt the user to enter N and the vector of values and thendisplay the number of positive, negative, and zero values.
Computers and Technology
1 answer:
murzikaleks [220]4 years ago
7 0

Answer:

see description

Explanation:

clicking in new script, we type the following:

%inputs and variables

N = input('Enter N : ');

values = input('Enter values : ');

positive=0;

negatives=0;

zero=0;

%for loop

for c = 1:N

   if values(c) > 0

       positive = positive + 1;

   elseif values(c) < 0

       negatives = negatives + 1;

   else

       zero = zero + 1;

   end

end

positive

negatives

zero

so we basically loop the array and add one to counters each time we read an element from the input, for example if we enter:

Example input

Enter N : 5

Enter values : [1,-1,0,2,352]

positive = 3

negatives = 1

zero = 1

You might be interested in
Which of the following is planted on an infected system and deployed at a predetermined time?A. Logic bombB. Trojan horseC. Worm
nekit [7.7K]

Answer:

A. Logic Bomb.

Explanation:

A Logic Bomb is a piece of code that is planted in a software system that is infected intentionally to set off malicious function.They are deployed at a predetermined time.

For ex:- a programmer hiding the files that deletes details of the employee who left the company.So these files can never be deleted.

4 0
3 years ago
Which view shows how the document will look when printed?
DIA [1.3K]
Please provide photos for your question.
7 0
4 years ago
Being nice take the points​
MArishka [77]

Answer:

Sure!!! and thank you very much

4 0
3 years ago
What kind of company would hire an Information Support and Service employee?
andrew-mc [135]

Answer:

THE GANG IS A GANG AND A GANG IS A GANG

Explanation:

4 0
3 years ago
One solid rule of thumb when prioritizing is to:
zalisa [80]

The only one that would make sense in for this is C


Answer- C

8 0
3 years ago
Read 2 more answers
Other questions:
  • Most internet connections use what transmission
    13·2 answers
  • You have configured a LAN with 25 workstations, three network printers, andtwo servers. The workstations and printers will have
    9·1 answer
  • The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per se
    9·1 answer
  • A construction company has an online system that tracks all of the status and progress of their projects. The system is hosted i
    10·1 answer
  • Checking authentication, checking authorization and access control, auditing systems, and verifying firewalls and other filters
    12·1 answer
  • Why are computer manufacture constantly releases fast computer and do user benefit from ths speed
    9·1 answer
  • What does this mean?​ pls help me
    12·1 answer
  • Computer programming 5
    10·1 answer
  • What is the current situation in farming​
    13·2 answers
  • 1.1<br> What are three reasons why decision-making is required in a programmed work cyde?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!