Test # 1 Review – Francisco Tamay

Section 3.1 # 6

Describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list

 

list Number Of Negative (a1, a2,…an)

i = 1 to n

N = number of negative numbers = 0

if ai < 0

N = N + 1

Return N

This entry was posted in Test #1 Review. Bookmark the permalink.

One Response to Test # 1 Review – Francisco Tamay

  1. Kate Poirier says:

    Looks pretty good Francisco. To be super clear, be sure to use “:=” for assignments so that you can save “=” for equality. Also, don’t forget the word “for” in your “for i :=1 to n.”

Leave a Reply

Your email address will not be published. Required fields are marked *