3. На скільки кроків переміститься об'єкт після виконання даної програми? * Коли натиснуто надати S значення 5 перемістити на Ѕ кроків перемістити на s кроків 1) 0 2) 15 3) 10 4) 5 іть будь ласка!!
Я только номер 1 понял как по схемам сделать, номер 2 аналогичен 1 только проверка (в ромбах) на числа от 4 до 8, от 9 до 15 от 16 до 20, от 21 до 3. А вот как третий номер делать по схемам я хз, если нужна прога на паскале, то скину
Паскаль 1 номер
program gg1; var a,b,c,a1,b1,c1,s:integer; begin writeln('Введите числo а'); read(a); writeln('Введите числo c'); read(c); writeln('Введите числo b'); read(b); if (a>=0) and (b>=0) and (c>=0) then begin a1:=sqrt(a) b1:=sqrt(b) c1:=sqrt(c) writeln(a1) writeln(b1) writeln(c1) end; else if (a<0) and (b<0) and (c<0) then begin a1:=a*a b1:=b*b c1:=c*c writeln(a1) writeln(b1) writeln(c1) end; else begin s:=a+b+c; writeln(s); end; end.
Uses Crt; Label BbIXOD, BBODN; Var A:array[1..19,1..19] of shortint; i,j,N,t:integer; Begin Randomize; BBODN: Write('N = ');ReadLn(N); ClrScr; if (N <= 0)or(N > 19) then GOTO BBODN; t:= 700 div N; For i:= 1 to N do Begin For j:= 1 to N do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' ') End; WriteLn; End; Delay(300); For i:= N downto 1 do Begin For j:= N downto 1 do Begin if (j < N) then Begin GotoXY(j*4+1,i); TextBackground(0); Write(A[i,j+1]:3,' '); GotoXY(1,N+1); End; TextBackground(2); GotoXY(j*4-3,i); Write(A[i,j]:3,' '); Delay(t); if A[i,j] mod 2 = 0 then Begin Delay(700); if i <> j then Begin TextBackground(12); GotoXY(j*4-3,i); Write(A[i,j]:3,' '); Delay(700); TextBackground(14); GotoXY(i*4-3,i); Write(A[i,i]:3,' '); Delay(700);
TextBackground(0); GotoXY(j*4-3,i); Write(A[i,j]:3,' '); TextBackground(2); GotoXY(i*4-3,i); Write(A[i,i]:3,' '); End; t:=-1; GOTO BbIXOD; End End; GotoXY(1,i); TextBackground(0); Write(A[i,j]:3,' ') End; BbIXOD: TextBackground(0); GotoXY(1,N+1); if t >= 0 then WriteLn('Чётных элементов не обнаружено'); WriteLn('Для повторного ввода N нажмите 0'); WriteLn('Для выхода - любую другую клавишу'); if ReadKey = '0' then Begin ClrScr; GOTO BBODN; End End.
Паскаль
1 номер
program gg1;
var a,b,c,a1,b1,c1,s:integer;
begin
writeln('Введите числo а');
read(a);
writeln('Введите числo c');
read(c);
writeln('Введите числo b');
read(b);
if (a>=0) and (b>=0) and (c>=0) then begin
a1:=sqrt(a)
b1:=sqrt(b)
c1:=sqrt(c)
writeln(a1)
writeln(b1)
writeln(c1)
end;
else
if (a<0) and (b<0) and (c<0) then begin
a1:=a*a
b1:=b*b
c1:=c*c
writeln(a1)
writeln(b1)
writeln(c1)
end;
else begin
s:=a+b+c; writeln(s); end; end.