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