1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | REM program CLS DIM numbers( 1000 ) enough = 1 count = 0 posCount = 0 offset = 1 i = 0 REM Entering of the sequence PRINT "Enter the sequence of the numbers. To stop enter 0 :" WHILE enough <> 0 count = count + 1 INPUT "->", numbers(count) enough = numbers(count) WEND REM Find the task WHILE offset < count IF numbers(offset) = numbers(offset - 1 ) THEN WHILE numbers(offset) = numbers(offset - 1 ) posCount = posCount + 1 offset = offset + 1 WEND PRINT "The number ", numbers(offset - posCount), " is in equal positions: " FOR i = offset - posCount TO offset PRINT i - 1 NEXT i END IF offset = offset + 1 posCount = 0 WEND END |
Тестирование выполнено в программе QB64 ( Скачать )