Program filework;
var f:text;
i, n, count:integer;
l:string;
arr:array of real;
answ:real;
begin
assign(f, 'C:\Users\HO4HOU_TTaPKuPucT\Desktop\test_file.txt'); // В кавычках путь к файлу
reset(f);
while not eof(f) do begin
readln(f, l);
if StrToFloat(l) > 0 then
Inc(count);
end;
SetLength(arr, count);
reset(f);
i:=0;
while not eof(f) do begin
readln(f, l);
if StrToFloat(l) > 0 then begin
arr[i]:=StrToFloat(l);
Inc(i);
end;
end;
answ:=arr[0];
for i:=1 to arr.Length - 1 do
if arr[i] < answ then answ:=arr[i];
writeln(answ);
close(f);
end.
P.S. Программа работает с неограниченным числом положительных чисел в файле
1.
program z1;
var x:real;
begin
writeln('Input x: ');
readln(x);
if (x<9) then
begin
x:=(x*x)/(x-9);
writeln('New x: ',x);
end
else
begin
x:=Sin(x);
writeln('New x: ',x);
end;
end.
Поясню выбор типа х: вещественный, т.к. функция синуса вернет не целое число.
2.
program z2;
var a,b,c:real;
begin
writeln('Input a, b, c:');
readln(a,b,c);
writeln('Числа, удовлетворяющие условию:');
if((a>1) and (a<3)) then
writeln(a);
if((b>1) and (b<3)) then
writeln(b);
if((c>1) and (c<3)) then
writeln(c);
end.
Ответ единица. :)
Пояснения или решение нужны?
0 так как это число вообще без нулей
Число от 2-х до 3-х не включая их.
Примеры:
2.4
2.000000000001
2.99999999999
2.44432432412423
и т.п.