1-е Задание:
Program PRG;
var
a, b, c, e, x, y, num, den: real;
function calc( a, b, c, e, x: real ): real;
begin
num := ((( abs(sin(x ** 3))) + a) * (e ** a));
den := (exp(ln((b ** 2) + (c ** 2)) / 3));
y := num / den;
Result := y;
write('Answer is: ', y);
writeln();
end;
function entNums (): real;
begin
write ('Enter a: '); readln (a);
write ('Enter b: '); readln (b);
write ('Enter c: '); readln (c);
write ('Enter e: '); readln (e);
write ('Enter x: '); readln (x);
writeln();
end;
begin
entNums();
calc( a, b, c, e, x );
end.
2-е Задание:
Program
var wallWid, wallHeight, winHeight, winWid, doorWid, doorHeight, fourWalls, door, win, total: real;
function getFourWalls( wallWid, wallHeight: real ): real;
begin
fourWalls := (wallHeight * wallWid) * 4;
Result := fourWalls;
end;
function getDoorSize( doorHeight, doorWid: real ): real;
begin
door := doorHeight * doorWid;
Result := door;
end;
function getWinSize( winHeight, winWid: real ): real;
begin
win := winHeight * winWid;
Result := win;
end;
function getWalls(): real;
begin
total := (fourWalls - ( door + win )) / 10000;
Result := total;
write(' You need ', total, ' m² of wallpaper!');
writeln();
end;
function enterSizes(): real;
begin
writeln();
write (' Enter width of the wall (in cm): '); readln (wallWid);
write (' Enter height of the wall (in cm): '); readln (wallHeight);
write (' Enter width of the window (in cm): '); readln (winWid);
write (' Enter hight of the window (in cm): '); readln (winHeight);
write (' Enter width of the door (in cm): '); readln (doorWid);
write (' Enter height of the doot (in cm): '); readln (doorHeight);
writeln();
end;
begin
enterSizes();
getFourWalls( wallWid, wallHeight );
getDoorSize( doorHeight, doorWid );
getWinSize( winHeight, winWid );
getWalls();
end.
Блок-схемы легко можешь составить глядя на коды программ)
Удачи)
1-е Задание:
Program PRG;
var
a, b, c, e, x, y, num, den: real;
function calc( a, b, c, e, x: real ): real;
begin
num := ((( abs(sin(x ** 3))) + a) * (e ** a));
den := (exp(ln((b ** 2) + (c ** 2)) / 3));
y := num / den;
Result := y;
write('Answer is: ', y);
writeln();
end;
function entNums (): real;
begin
write ('Enter a: '); readln (a);
write ('Enter b: '); readln (b);
write ('Enter c: '); readln (c);
write ('Enter e: '); readln (e);
write ('Enter x: '); readln (x);
writeln();
end;
begin
entNums();
calc( a, b, c, e, x );
end.
2-е Задание:
Program
var wallWid, wallHeight, winHeight, winWid, doorWid, doorHeight, fourWalls, door, win, total: real;
function getFourWalls( wallWid, wallHeight: real ): real;
begin
fourWalls := (wallHeight * wallWid) * 4;
Result := fourWalls;
end;
function getDoorSize( doorHeight, doorWid: real ): real;
begin
door := doorHeight * doorWid;
Result := door;
end;
function getWinSize( winHeight, winWid: real ): real;
begin
win := winHeight * winWid;
Result := win;
end;
function getWalls(): real;
begin
total := (fourWalls - ( door + win )) / 10000;
Result := total;
write(' You need ', total, ' m² of wallpaper!');
writeln();
end;
function enterSizes(): real;
begin
writeln();
write (' Enter width of the wall (in cm): '); readln (wallWid);
write (' Enter height of the wall (in cm): '); readln (wallHeight);
write (' Enter width of the window (in cm): '); readln (winWid);
write (' Enter hight of the window (in cm): '); readln (winHeight);
write (' Enter width of the door (in cm): '); readln (doorWid);
write (' Enter height of the doot (in cm): '); readln (doorHeight);
writeln();
end;
begin
enterSizes();
getFourWalls( wallWid, wallHeight );
getDoorSize( doorHeight, doorWid );
getWinSize( winHeight, winWid );
getWalls();
end.
Блок-схемы легко можешь составить глядя на коды программ)
Удачи)
Поделитесь своими знаниями, ответьте на вопрос:
9класс циклическое программирование 1.составьте программу которая вычисляет сумму натуральных чисел кратных 4 в диапазоне от 5 до 45 2.найти сумму нечетных чисел от 79 до 205 3.найти значение функции на отрезке [1; 10] с шагом 0, 5
Var S,A:integer;
Begin
S:=0;
For A:= 5 to 45 do
if A mod 4 = 0 then S:=S+A;
WriteLn('S = ',S);
End.
Результат работы программы:
S = 260
Вторая программа:
Var A,S:integer;
Begin
S:=0;
For A:= 79 to 205 do
if A mod 2 <> 0 then S:=S+A;
WriteLn('S = ',S);
End.
Результат работы программы:
S = 9088
Третья программа:
Var
x:byte;
Begin
WriteLn('f(x) = x^2');
For x:= 1 to 20 do
WriteLn('f(',x/2:3,') = ',Sqr(x/2))
End.
Результат работы программы:
f(x) = x^2
f(0.5) = 0.25
f( 1) = 1
f(1.5) = 2.25
f( 2) = 4
f(2.5) = 6.25
f( 3) = 9
f(3.5) = 12.25
f( 4) = 16
f(4.5) = 20.25
f( 5) = 25
f(5.5) = 30.25
f( 6) = 36
f(6.5) = 42.25
f( 7) = 49
f(7.5) = 56.25
f( 8) = 64
f(8.5) = 72.25
f( 9) = 81
f(9.5) = 90.25
f( 10) = 100