Задача 16 Урок 13.1
Primary tabs
Модифицируйте решение предыдущей задачи. так чтобы пользователь вводил второе число M, которое отвечало бы за длину возрастающего фрагмента, например для M=4
var n,m,i,j:integer; begin writeln('Vvedite celoe chislo: '); readln(n); writeln('Vvedite shag posledovatelnosti: '); readln(m); i:=6; if((n>0)and(n>=8))then while (i<n) do begin for j:=1 to m do begin i:=i+2; if (i<=n) then write(i,' '); end; if (i<n) then write(3,' '); end else writeln('Oshibka! Chislo ne sootvetstvuet usloviam!'); end.
Консоль:
Vvedite celoe chislo: 30 Vvedite shag posledovatelnosti: 4 8 10 12 14 3 16 18 20 22 3 24 26 28 30
- Log in to post comments
- 419 reads