1) а) на Java class example{ public static void main (String[] args){ int k = 0, j = 0; for (int i = 0; i < 10; i++){ k = k + 5; j = j + k; if (i == 9) System.out.print(k); else System.out.print(k + " + "); } System.out.print(" = " + j); } } б) на Pascal var a,b,c:integer; begin for a:=1 to 10 do begin b:=b+5; c:=c+b; if (a = 10) then write(b) else write(b, ' + ') end; write(' = ', c); end. 2) а) на Java class example{ public static void main(String args[]){ for (int x = 50; x >= 40; x--){ double y = (5 * x) + (Math.pow(x, 2)); int i = (int) y; System.out.println(i); } } } б) на Pascal var y:real; x:integer; begin for x:=50 downto 40 do begin y:=(5*x)+sqr(x); writeln(y:0:0); end; end.
1.y=m1*m2/Sqr(r)
2. Program my;
var S,a,b,h:real;
begin
write('Введите длины оснований и высоты');
readln(a,b,h);
S:=(a+b)*h/2;
readln(S);
end.
3. Program my;
var a:integer;
begin
writeln('Введите трехзначное число');
readln(a);
If (a mod 10=7) then write('Данное число заканчивается на 7');
else write('Данное число не заканчивается на 7');
end.
4.Program my;
var a,b,:integer;
begin
readln(a,b);
If (a>b) then writeln(Sqr(a), b+10);
If (a=b) then writeln('Числа равны');
If (a<b) then writeln(Sqr(b), a+10);
end.
5.
Program my;
var a,b,c:integer;
begin
Readln(a,b);
For c:=a to b do
if (c mod 10=0) then
writeln (c);
end.
class example{
public static void main (String[] args){
int k = 0, j = 0;
for (int i = 0; i < 10; i++){
k = k + 5;
j = j + k;
if (i == 9)
System.out.print(k);
else
System.out.print(k + " + ");
}
System.out.print(" = " + j);
}
}
б) на Pascal
var a,b,c:integer;
begin
for a:=1 to 10 do
begin
b:=b+5;
c:=c+b;
if (a = 10) then write(b)
else write(b, ' + ')
end;
write(' = ', c);
end.
2) а) на Java
class example{
public static void main(String args[]){
for (int x = 50; x >= 40; x--){
double y = (5 * x) + (Math.pow(x, 2));
int i = (int) y;
System.out.println(i);
}
}
}
б) на Pascal
var y:real;
x:integer;
begin
for x:=50 downto 40 do
begin
y:=(5*x)+sqr(x);
writeln(y:0:0);
end;
end.