Imports System,Console
Module Module1
Sub Main() 'Раскомментировать нужную (под)программу
'Fst()
'Snd()
'Trd()
'Foth()
'Fth()
End Sub
Sub Fst()
Dim a, b, c As Double
b = 8.45
a = Double.Parse(ReadLine())
c = Double.Parse(ReadLine())
WriteLine("y({0}, {1}) = {2}", a, c, Math.Sin(a) : 2 - b * Math.Acos(c) + Math.E : (-3.4 * a) + 2 * Math.Log(Math.Abs(a - c)))
ReadKey(False)
End Sub
Sub Snd()
Dim x As Double = Double.Parse(ReadLine())
WriteLine("y({0}) = {1}", x, Math.E : IIf(x > 2, x, IIf(x < 1, (2 * x), -x)))
ReadKey(False)
End Sub
Sub Trd()
For x As Double = 5 To 65
WriteLine("y({0}) = {1}", x, (x / 2) + ((x : 2 + Math.E : (-x)) / 20))
Next
ReadKey(False)
End Sub
Sub Foth() ' Тут лучше было бы использовать указатели, ну да так проще
Dim a(10), min As Double
Dim x As Integer
For x = 0 To 9
Write("a({0}) => ", x)
a(x) = Double.Parse(ReadLine())
Next
min = a(0)
For x = 1 To 9
If (a(x) < min) Then
min = a(x)
End If
Next
For x = 0 To 9
If (a(x) Mod 2 = 1) Then
a(x) = min
End If
Next
For x = 0 To 9
WriteLine("a({0}) => {1}", x, a(x))
Next
ReadKey(False)
End Sub
Sub Fth()
Dim p, s, a(36) As Double
p = 1
For x As Integer = 0 To 35
Write("a({0}) => ", x)
a(x) = Double.Parse(ReadLine())
If (x < 5) Then
p *= a(x)
Else
s += a(x)
End If
Next
WriteLine("p(1..5) = {0}", p)
WriteLine("s(6..36) = {0}", s)
WriteLine("p(1..5) / s(6..36) = {0}", p / s)
ReadKey(False)
End Sub
End Module