Дано n число, действительные числа a1,a2,….an.Верно ли,что отрицательных чисел в последовательности больше,чем положительных — PureBasic(Бейсик)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
poloj=0
otric=0
FOR i=1 TO n
  if a(i) > 0 then
    poloj = poloj + 1
  end if
  if a(i) < 0 then
    otric = otric + 1
  end if
NEXT i
  
if poloj < otric then
  PRINT "Verno"
ELSE
  PRINT "Vran'e"
end if

Leave a Comment