Last active
June 9, 2020 16:25
-
-
Save matisiekpl/49ef901607aa8475eb4ae17e9ef9be71 to your computer and use it in GitHub Desktop.
Zadanie z VBA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub zad1() | |
Dim a As Integer | |
Dim b As Integer | |
a = InputBox("Podaj długość boku A") | |
b = InputBox("Podaj długość boku B") | |
Dim obw As Integer | |
obw = 2 * (a + b) | |
If obw = 50 Then | |
MsgBox ("Obwód jest równy 50") | |
Else | |
MsgBox ("Obwód jest różny od 50") | |
End If | |
End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub zad2() | |
Dim i As Integer | |
Dim ilosc As Integer | |
For i = 1 To 35 | |
If Cells(i, 1).Value > 10 Or Cells(i, 1).Value < 3 Then | |
ilosc = ilosc + 1 | |
End If | |
Next | |
MsgBox ("Ilość liczb spełniających warunek: " & ilosc) | |
End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub zad3() | |
Dim Tablica(4, 4) As Integer | |
Dim i As Integer | |
Dim j As Integer | |
i = 0 | |
j = 0 | |
Do | |
If i <= 4 Then | |
Do | |
If j <= 4 Then | |
Tablica(i, j) = (i + 1) - (j + 1) | |
Else | |
Exit Do | |
End If | |
j = j + 1 | |
Loop | |
Else | |
Exit Do | |
End If | |
i = i + 1 | |
j = 0 | |
Loop | |
Range("A1:E5") = Tablica | |
End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub zad4() | |
Dim a As Integer | |
Dim b As Integer | |
Dim c As Integer | |
a = InputBox("Podaj pierwszą liczbę") | |
b = InputBox("Podaj drugą liczbę") | |
c = InputBox("Podaj trzecią liczbę") | |
If a Mod b = 0 Or a Mod c = 0 Then | |
MsgBox ("tak") | |
Else | |
MsgBox ("nie") | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment