Даны натуральные числа от 20 до 50 определите те из них, которые делятся на 3, но не делятся на пять. на Pascal abc. используя 3 вида цикла(предусловием, постусловием, с параметром)
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
DIM a AS SINGLE, b AS SINGLE, h AS SINGLE DIM x AS SINGLE, y AS SINGLE CLS INPUT "Vvedite a,b,h: ", a, b, h FOR x = a TO b STEP h y = 1 / 2 * LOG(x ^ 2) + 1 / x ^ 2 + 2 - 1 / 2 * LOG(2) / 3 PRINT "x="; x, "y="; y NEXT x END
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