Вариант 4, VBA Excel. Пример Кода: SUB lab5() Dim i As Byte Dim d As Single, x1 As Single, x2 As Single, a As Single, b As Single, c As Single, t As Single i=1: c=1: b=3: h=0.1 For t=0 To 1 Step h a=sin(t) d=b^2-4*a*c If d>=0 Then x1=(-b+sqr(d))/(2*a) x2=(-b-sqr(d))/(2*a) Cells(i,1)=x1 Cells(i,2)=x2 Else Cells(i,1)=”Корней нет” End If i=i+1 Next t ActiveSheet.range(“A1:B11”).select With selection .Font.bold=true .Font.italic=true .font.size=14 . font.name =”Times New Roman” .bord2ers.color=RGB(100,0,100) End With End SUB
SUB lab5()
Dim i As Byte
Dim d As Single, x1 As Single, x2 As Single, a As Single, b As Single, c As Single, t As Single
i=1: c=1: b=3: h=0.1
For t=0 To 1 Step h
a=sin(t)
d=b^2-4*a*c
If d>=0
Then
x1=(-b+sqr(d))/(2*a)
x2=(-b-sqr(d))/(2*a)
Cells(i,1)=x1
Cells(i,2)=x2
Else Cells(i,1)=”Корней нет”
End If
i=i+1
Next t
ActiveSheet.range(“A1:B11”).select
With selection
.Font.bold=true
.Font.italic=true
.font.size=14
. font.name =”Times New Roman”
.bord2ers.color=RGB(100,0,100)
End With
End SUB