Imports System Module MainModule Sub Main() Dim a, b, h, S As Double Console.Write("a = ") a = Console.ReadLine() Console.Write("b = ") b = Console.ReadLine() Console.Write("h = ") h = Console.ReadLine() S = (a + b) / 2 * h Console.Write("S = ") Console.WriteLine(S) Console.ReadKey End Sub End Module
Задача 2:
Imports System Module MainModule Sub Main() Dim x, y As Double Console.Write("x = ") x = Console.ReadLine() Console.Write("y = ") y = Console.ReadLine() If (x < 0) And (y < 0) Then x = -x y = -y Else If (x < 0) Or (y < 0) Then x += 0.5 y += 0.5 Else If (x >= 0.5) And (x <= 2) And (y >= 0.5) And (y <= 2) Then x /= 10 y /= 10 End If Console.Write("x = ") Console.WriteLine(x) Console.Write("y = ") Console.WriteLine(y) Console.ReadKey End Sub End Module
Var i,x1,x2:integer; begin for i:=10 to 99 do begin x1:=i mod 10; x2:=i div 10; if (sqr(x1)+sqr(x2)) mod 13=0 then writeln(i); end; end.
//1б Var i,x1,x2:integer; begin for i:=10 to 99 do begin x1:=i mod 10; x2:=i div 10; if x1+x2+sqr(x1+x2)=i then writeln(i); end; end.
//2 Var i,n,a,k1,k2:integer; begin readln(n); for i:=1 to n do begin readln(a); if a<1985 then k1:=k1+1; if a>1990 then k2:=k2+1; end; writeln('Родившиеся до 1985:',k1); writeln('Родившиеся после 1990:',k2); end.
uses crt;
var
n,S,i: integer;
begin
clrscr;
writeln('Введите n: ');
readln(n);
for i:=1 to n do
S:=S+i*i;
writeln('ответ: ',S);
end.