1. ## Please write Psedocode

Write an algorithm that searches a sequence S, of length n, for the number of negative elements. The algorithm should return the number of negative elements.

i am appreciate for any potential answers from anybodies.

2. Originally Posted by swikar.maths
Write an algorithm that searches a sequence S, of length n, for the number of negative elements. The algorithm should return the number of negative elements.

i am appreciate for any potential answers from anybodies.
Initialise a counter to zero, then loop over the elements of the sequence incrementing the counter by one every time the element in the sequence is negative, return the counter.

CB

3. ## Write an algorithms return negative elements

Hello Captainblack,
you answered my question regarding Psedocode.
Please can you please writedown in Psedocode language like count = 0
for loop..

Thnaks,

4. Originally Posted by swikar.maths
Hello Captainblack,
you answered my question regarding Psedocode.
Please can you please writedown in Psedocode language like count = 0
for loop..

Thnaks,
There is no such thing as "Pseudo-Code", you make it up as you go, the key thing is that it can be translated unambiguously into a programming language. In which case:

Code:
Initialize a counter to zero, then loop over the elements of the sequence incrementing the counter by one every time the element in the sequence is negative, return the counter.
is pseudo-code, as is:

Code:
Initialize a counter to zero,
Loop over the elements of the sequence
Increment the counter by one every time the element is negative,
return the counter.
or:

Code:
counter=0
for idx=1 to n
if S(idx)<0
counter=counter+1
endif
endfor
return counter
CB