x := 0; repeat x := x + 0.03; y := f(x); SetPixel(round(300 + 10 * x), round(240 - 10 * f(x)), clGreen); until 300 + 10 * x > 620 end.
с апгрейдом
uses graphabc; const scale = 20;
var i: integer; x, y: real;
function f(x: real): real; begin if x < 0 then f := 0 else f := sqrt(3 * x); end;
begin Window.Init(0, 0, 1000, 1000, clMoneyGreen); Window.CenterOnScreen;
Line(0, Window.Height div 2, Window.Width, Window.Height div 2); Line(Window.Width div 2, 0, Window.Width div 2, Window.Height); TextOut(Window.Width div 2 + 5, 10, 'y=sqrt(3x)');
x := -1; repeat SetPixel(round(Window.Width div 2 + scale * x), round(Window.Height div 2 - scale * f(x)), clRed); x := x + 0.03; until scale * x > Window.Width div 2 end.
var
i: integer;
x, y: real;
function f(x: real): real;
begin
f := sqrt(3 * x);
end;
begin
Line(0, 240, 620, 240);
Line(300, 0, 300, 900);
TextOut(310, 10, 'y=sqrt(3x)');
x := 0;
repeat
x := x + 0.03;
y := f(x);
SetPixel(round(300 + 10 * x), round(240 - 10 * f(x)), clGreen);
until 300 + 10 * x > 620
end.
с апгрейдом
uses graphabc;
const
scale = 20;
var
i: integer;
x, y: real;
function f(x: real): real;
begin
if x < 0 then
f := 0
else
f := sqrt(3 * x);
end;
begin
Window.Init(0, 0, 1000, 1000, clMoneyGreen);
Window.CenterOnScreen;
Line(0, Window.Height div 2, Window.Width, Window.Height div 2);
Line(Window.Width div 2, 0, Window.Width div 2, Window.Height);
TextOut(Window.Width div 2 + 5, 10, 'y=sqrt(3x)');
x := -1;
repeat
SetPixel(round(Window.Width div 2 + scale * x), round(Window.Height div 2 - scale * f(x)), clRed);
x := x + 0.03;
until scale * x > Window.Width div 2
end.
Задача 1
program z1;
var n,a,i,k:integer;
begin
write ('Введите количество чисел: ');
read (n);
for i:=1 to n do
begin
write ('Введите число: ');
read (a);
if a = 0 then k:=k+1
end;
writeln('Количество нулей среди чисел: ',k)
end.
Задача 2
program z2;
var n,a,i,m:integer;
begin
write ('Введите количество чисел: ');
read (n);
for i:=1 to n do
begin
write ('Введите число: ');
read (a);
if i = 1 then m:=a;
if a > m then m:=a
end;
writeln('Максимальное число среди чисел: ',m)
end.
или
program z2;
var n,i,m:integer;
a:array[1..100] of integer;
begin
write ('Введите количество чисел (n<=100): ');
read (n);
for i:=1 to n do
begin
write ('Введите число: ');
read (a[i]);
if i = 1 then m:=a[i];
if a[i] > m then m:=a[i]
end;
writeln('Максимальное число среди чисел: ',m)
end.