- Sub lab1_02()
- Dim l1 As Double, l2 As Double, l3 As Double, suma As Integer, srednia As Double
- l1 = InputBox("podaj wartosc l1", "L1", 0)
- l2 = InputBox("podaj wartosc l2", "L2", 0)
- l3 = InputBox("podaj wartosc l3", "L3", 0)
- srednia = (l1 + l2 + l3) / 3
- Range("a1").Value = "srednia"
- If srednia >= 4 Then
- MsgBox ("Srednia wynosi " & srednia & ". Dobrze")
- Else
- MsgBox ("Srednia wynosi " & srednia & ". Slabo")
- End If
- End Sub
- Sub lab_03()
- Dim ocena As Double
- ocena = InputBox("podaj ocene", "Ocena", 0)
- If ocena = 5 Then
- MsgBox ("Doskonale")
- ElseIf ocena = 4.5 Then
- MsgBox ("dobrze")
- ElseIf ocena = 4 Then
- MsgBox ("dobrze")
- ElseIf ocena = 3.5 Then
- MsgBox ("oj slabiutko")
- ElseIf ocena = 3 Then
- MsgBox ("oj slabiutko")
- ElseIf ocena = 2.5 Then
- MsgBox ("oblales")
- ElseIf ocena = 2 Then
- MsgBox ("Oblales")
- Else
- MsgBox ("Zla ocena")
- End If
- End Sub
- Sub lab_05()
- Dim ocena As Double, ocena2 As Double
- ocena = InputBox("podaj ocene", "Ocena", 0)
- Select Case ocena
- Case 5
- MsgBox ("Doskonale")
- Case 4.5
- MsgBox ("Dobrze")
- Case 4
- MsgBox ("Dobrze")
- Case 3.5
- MsgBox ("oj slabiutko")
- Case 3
- MsgBox ("oj slabiutko")
- Case 2.5
- MsgBox ("Oblales")
- Case 2
- MsgBox ("Oblales")
- End Select
- End Sub
- Sub lab_06()
- Dim ocena As Double, ocena2 As Double, srednia As Double
- ocena = InputBox("podaj ocene", "Ocena", 0)
- ocena2 = InputBox("podaj ocene", "Ocena2", 0)
- Select Case ocena
- Case 2, 2.5, 3, 3.5, 4, 4.5, 5
- Select Case ocena2
- Case 2, 2.5, 3, 3.5, 4, 4.5, 5
- srednia = (ocena + ocena2) / 2
- MsgBox ("Srednia wynosi " & srednia)
- Case Else
- MsgBox ("Ocena2 jest bledna")
- End Select
- Case Else
- MsgBox ("Ocena1 jest bledna")
- End Select
- End Sub
- Sub lab_07()
- Dim a As Double, b As Double, c As Double, delta As Double, lin As Double, x1 As Double, x2 As Double, x3 As Double
- Range("a1").Value = "a"
- Range("b1").Value = "b"
- Range("c1").Value = "c"
- Range("a3").Clear
- Range("b3").Clear
- Range("c3").Clear
- a = InputBox("podaj a", "Ocena", 0)
- b = InputBox("podaj b", "Ocena2", 0)
- c = InputBox("podaj c", "Ocena2", 0)
- If a = 0 Then
- lin = -b / c
- Range("c3").Value = lin
- Else
- delta = b * b - 4 * a * c
- End If
- If delta > 0 Then
- x1 = (-b - Sqr(delta)) / 2 * a
- x2 = (-b + Sqr(delta)) / 2 * a
- ElseIf delta = 0 Then
- x3 = -b / 2 * a
- Else
- MsgBox ("Brak m zerowych")
- End If
- Range("a2").Value = a
- Range("b2").Value = b
- Range("c2").Value = c
- Range("a3").Value = x1
- Range("b3").Value = x2
- End Sub