Anda di halaman 1dari 3

1.) To repeat an action as many times as you want with minimum code.

2.) The do loop will execute the statement at least once, while the do while
executes and then checks if the statement continues to be true
3a.) a loop that has no break point
3b.) a loop without a break point
4a.) MessageBox.show() InputBox()
4b.) Both are dialog boxes
4c.) Once accepts input while the other shows a message
5.)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim num As Integer = InputBox("Enter Number")
While num > 30 Or num < 1
num = InputBox("Enter Number")

End While

End Sub

6.) Accumulator:

Each time you find a value, you add it to the accumulator variable. At the end, the accumulator
variable will contain the sum of all the values found.

Counter:

Each time you find a value, you increment the counter by one. At the end, the value of the counter will
be equal to the number of items found.

7.) The do loop will keep checking if the statement is true before looping again and the for next will
execute until a certain value is reached\

8a.) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim startnum As Integer = 2
Dim counter As Integer = 0
Do While startnum < 99
startnum = startnum + 3
counter = counter + 1
Loop
Label1.Text = startnum / counter
End Sub

8b.) For index As Integer = 2 To 99 Step 3


counter = counter + 1
startnum = startnum + index
Next
Label1.Text = startnum / counter

9.)String holds chars and the integer hold number values

10.) Array of bytes

11.) number = Me.txtNumber.text


For i As Integer = 1 To number 4
sum = sum + i(number.toSubstring(0,i))
Next i
MessageBox.Show(the sum of the digits in + number + is + sum)

12.) string = string +

char ch[]={ R,Y,A,N};


String str2=new String(ch);

13.) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim somestring As String = ""
Dim all As String = ""

While Not somestring.Equals(".")


somestring = InputBox("Enter word")
all = all + somestring + " "
End While
Label1.Text = all
End Sub

15.)
a.) test now
b.) TesT
c.) T
d.) 1
e.) 0

16.) & should be +

18.) 012345678901234567890123456789 + This & vTab & Is & vbCrlf & :So wonderful &
and marvelous

19.) vIsUal bAsIC Is SO mucH FUn!.

20a.) Dim sometext As String = txt.gettext()

Dim all as string() = sometext.split( )

Number = all.length + 1

20b.) counter = 0

Randomstring = txt.text
For c as char in randomstring

counter = counter + 1

21a.) True

21b.) False

21c.) True

21d.) False

21e.) False

21f.) False

21g.) True

21h.) False

21i.) True

212j.) True

21k.) False

21l.) True

21m.) True

21n.) True

21o.) False

Anda mungkin juga menyukai