var a,b,t,M,R:integer;
Function F(x: integer):integer;
begin
F := 5*(x+10)*(x+2)+2;
end;
BEGIN
a := -20; b := 20;
M := a; R:= F(a);
for t := a to b do
if (F(t)<R) then begin
M := t;
R:= F(t);
end;
write(M);
END.
|
#include<stdio.h>
int a,b,t,M,R;
int F(x: integer);
{
return 5*(x+10)*(x+2)+2;
}
main()
{
a = -20; b = 20;
M = a; R = F(a);
for(t=a;t<=b;t++)
if (F(t)<R) {
M = t;
R = F(t);
}
printf(«%d»,M);
}
|
def F(x):
return 5*(x + 10) * (x + 2) + 2
a = -20
b = 20
M = a
R = F(a)
for t in range (a, b+1):
if F(t) < R:
M = t
R = F(t)
print (M) |